java - Calculate SHA1 or MD5 hash in iReport -


How will the SHA1 or MD5 hash be counted within iReport on report execution? I need to compare a hash that runs before a database against a database based area (string).

iReport 2.0.5 (old) and report engine has been used in a commercial application.

I used the iReport and Jasper reports a few years ago and I do not remember details, but I Remember that you can put some Java code evaluated by using that feature you can calculate MD5 in some rows:

  string encryption algorithm = "MD5 "; String Value ToEncrypt = "Stack Overflow"; MessageDigest msgDgst = MessageDigest.getInstance (Encryption Algorithm); MsgDgst.update (valueToEncrypt.getBytes (), 0, valueToEncrypt.length ()); String MD5 = New BigInter (1, msgDgst.digest ()). ToString (16); Println (md5);  

java.math.BigInteger, java.security.MessageDigest and java.security.NoSuchAlgorithmException need to be imported;

SHA1 is almost identical to calculating hash:

  string encryption algorithm = "SHA-1"; String Value ToEncrypt = "Stack Overflow"; MessageDigest msgDgst = MessageDigest.getInstance (Encryption Algorithm); Byte [] sha1hash = new byte [40]; MsgDgst.update (valueToEncrypt.getBytes (), 0, valueToEncrypt.length ()); Sha1hash = md.digest ();  

Check out this blog post about creating variables which can be evaluated on report run time


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -