开发者

Blackberry scrambled device ID in 8 characters unique

I need to scramble Device IDs on the Blackberry for privacy matter. Whe开发者_StackOverflow社区n I call the function DeviceInfo.getDeviceId() I got a 9 characters number. After convert it in Hexa, I got the real PIN number for the device (or device ID depends how you call that) on 8 characters.

Like I said, for privacy matter I can't store the PIN as is in my database. So I would like to scramble the ID to a unique one, still in 8 characters. If I do MD5 or other encryption, I always got an number containing more than 8 characters.

Do you know a way to get a unique 8 characters string from the Device ID? Thank you.


You can use a short block cipher to obsfucate the message. Look at the CBC-MAC mode of operation.

As the output you want is actually only 4 bytes long, you could even use a CRC, such as CRC32.

Note that you would need a "perfect hash" to not have an overlap - neither short key CBC-MAC or CRC32 will give you a perfect hash. I would strongly suggest using a longer hash function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜