0

I'm planning to run a business Charging Station. To register that charging station in my server I need the custom id (Device ID).

In my scenario. I have an img of my program. Anyone can download the img and put it on their raspberrypi. I want to create a custom id for every raspberry pi.

I'm planning to use serial and hardware from /proc/cpuinfo. But I don't have any idea on how to do base on my preferred id.

Do you have any Idea?

Preffered ID: IDHQ321001 IDAZ74190i IDHQ621AQW

Borz
  • 1
  • 1
  • Hello. Are you asking how to parse the information in /proc/cpuinfo or how to generate these "preferred ID" strings? How are the two supposed to be related & is it unique to the Raspberry Pi? – Roger Jones Apr 27 '20 at 08:05
  • Hi @RogerJones. I want to generate the preffered ID based on unique ID of Raspberr Pi. Any Idea? – Borz Apr 27 '20 at 08:39
  • considering all pi's now report hardware as BCM2835 - there's no point using that as any sort of input to your algorithm - now, since the serial number is 64 bits, to get 8 byte serial number will require some hashing, since you simply can't represent 64 bits in 8 bytes – Jaromanda X Apr 27 '20 at 09:09
  • The word hash us what i looking. Thanks – Borz Apr 27 '20 at 09:30

2 Answers2

1

You should really generate your own ID instead of relying on an existing one. Then you can chose any format you like, guarantee uniqueness, make the ID cryptographically strong, etc. etc.

If you're under the impression that using hardware IDs from /proc/cpuinfo offer you some sort of copy protection, rest assured that this is not the case. In Linux, you can trivially fake any file using chroot command, LD_PRELOAD variable and some other means.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144
0

If you intend, as discussed in the comments, to use the 64-bit processor serial number "hashed" into a shorter string to use as your ID then my suggestion would be to look at one of the many base32 encoding schemes to generate a string from the serial number instead.

For example, RFC4648 encoding 0x01234567 and dropping the padding character gives you AERUKZY. You could also use base64url (also from RFC4648) and get ASNFZw but with base64 you will get some non-alphanumeric characters as well as a mix of upper- and lower-cases in the resulting string, from your given examples that does not seem to be acceptable.

Some further reading that might be of use:

Roger Jones
  • 1,494
  • 7
  • 14