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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -