I am writing a program that and like to implement data verification system. It needs to return a unique string for any value entered. My question boils down to: is it possible for an AES function to return the same value for two different entries? The source values will becoming from data held on a magnetic stripe card.
more details
I posted this through my phone originally, and I am now just getting back to this post.
I’ve been looking around the web and while reading Wikipedia’s article on SHA, I see that SHA-2 (SHA-256/224, SHA-512/384) have no detected collisions (assuming the article is accurate/up-to-date). This is desirable. Any recommendations on what version of SHA-2 I should use?
AES is an encryption scheme, not a hashing scheme, so in its straightforward application, it will return a lump of data as long as your message, but encrypted. For any unique message, the ciphertext will also be unique.
It sounds like what you want is a hash, or ‘digest’ of your data – look at something like SHA256. This will give you a fixed-length result regardless of the length of your data. This means that there ARE inevitably multiple different inputs which will give the same output, but they’re incredibly thinly spread across an incredibly large space.
The type of hash you should use depends on whether you’re trying to protect against malicious attempts to subvert your scheme, or just against random errors.