java - SHA1 Hash on Hex String -
i'm trying hash number, represented hex string java security library. meaning, if have string "aabbccdd" want hash not ascii input, 0x65, 0x65, 0x66, 0x66, 0x67, 0x67, 0x68, 0x68, 4 bytes - 0xaa, 0xbb, 0xcc, 0xdd. managed low values such "112233445566" (since bytes signed in java) failed high values.
does know how implement such thing?
thanks, binyamin
first convert hex byte[]
using example this: convert string representation of hex dump byte array using java?
after use
byte[] data = hexstringtobytearray(hexdata); messagedigest md = messagedigest.getinstance("sha-1"); md.update(data, 0, data.length); byte[] sha1hash = md.digest();
Comments
Post a Comment