AES Encryption and Obfuscating IDs

女生的网名这么多〃 提交于 2019-12-25 05:26:15

问题


I was considering hashing small blocks of sensitive ID data but I require to maintain the full uniqueness of the data blocks as a whole once obfuscated.

So, I came up with the idea of encrypting some publicly-known input data (say, 128 bits of zeroes), and use the data I want to obfuscate as the key/password, then throw it away, thus protecting the original data from ever being discovered.

I already know about hashing algorithms, but my problem is that I need to maintain full uniqueness (generally speaking a 1:1 mapping of input to output) while still making it impossible to retrieve the actual input. A hash cannot serve this function because information is lost during the process.

It is not necessary that the data be retrieved once "encrypted". It is only to be used as an ID number from then on.

An actual GUID/UUID is not suitable here because I need to manually control the identifiers on a per-identifier basis. The IDs cannot be unknown or arbitrarily generated data.


EDIT: To clarify exactly what these identifiers are made of:

  • (unencrypted) 64bit Time Stamp
  • ID Generation Counter (one count for each filetype)
  • Random Data (to make multiple encrypted keys dissimilar)
  • MAC Address (or if that's not available, set top bit + random digits)
  • Other PC-Specific Information (from registry)

The whole thing should add up to 192 bits, but the encrypted section's content size(s) could vary (this is by no means a final specification).


Given:

  • A static IV value
  • Any arbitrary 128bit key
  • A static 128 bits of input

Are AES keys treated in a fashion that would result in a 1:1 key<---->output mapping, given the same input and IV value?


回答1:


No. AES is, in the abstract, a family of permutations of which you select a random one with the key. It is the case that for one of those permutations(i.e. for encryption under a given AES key) you will not get collisions because permutations are bijective.

However, for two different permutations (i.e. encryption under different AES keys, which is what you have), there is no guarantee what so ever that you don't get a collision. Indeed, because of the birthday paradox, the likelihood of a collision is probably higher than you think.

If your ID's are short ( < 1024 bits) you could just do an RSA encryption of them which would give you want you want. You'd just need to forget the private key.



来源:https://stackoverflow.com/questions/11496839/aes-encryption-and-obfuscating-ids

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!