Created
October 20, 2009 05:27
-
-
Save fumokmm/214021 to your computer and use it in GitHub Desktop.
groovy(java)にて、SHA-1ハッシュを求める
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.* | |
MessageDigest md = MessageDigest.getInstance('SHA-1') | |
md.update('1234'.getBytes('UTF-8')) | |
def result = md.digest().collect{ String.format('%02x', it) }.join() | |
assert result == '7110eda4d09e062aa5e4a390b0a572ac0d2c0220' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment