java - md5 and salt -


1.1 ahead of Grails 1.1 is available on strings 'encodeAsMD5' - is there any way to provide salt for the function?

specific use:

  $ {myString.encodeAsMD5 ()}  

Another option is to use the Apache Digestuals Class.

I am not using it to do password hashing - instead, I am using it for verification purposes when a request was made and when the response was received .

To get started, I encrypt the date / time when a request was initially created and it was passed to the customer. Later, when the customer returns some data, then the original hash value is included in it to determine how much time has passed.

Do you want a salt because you are trying to havehing password? If so, consider a safe, easy-to-use password, the password hashing library. You can probably hook it up as a groovy string metamethod easily. : - P

And if you are not washing the password, I am not sure where one salt will come; Please feel free to expand in that case. : -)


How to use HMAC to use the keying hashing (I use the HmacMD5 in my example, but you do not have to type the HmacSHA1 HmacSHA256 , HmacSHA384 , or HmacSHA512 also):

  import javax.crypto.mac; Import javax.crypto.spec.SecretKeySpec; Public byte [] HMACMD5 (byte [] key, byte [] data) {mac mac = mac.just instance ("hmcmd5"); Mac.init (new secret speaker (key, "HMACMD5")); Mac.update (data); Return Mac.Dophal (); }  

I'm sorry that this is in Java and not groovy, but hopefully it will be easy for you to be friendly. :-) However, in this example, your constant value will be key, and incoming data will be data.

If your data is too large (if you have not described it possible), then you will call updates many times, and hash will work such as the data of those calls Was mixed together.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -