Skip to content

Instantly share code, notes, and snippets.

@fumokmm
Created October 20, 2009 05:27
Show Gist options
  • Save fumokmm/214021 to your computer and use it in GitHub Desktop.
Save fumokmm/214021 to your computer and use it in GitHub Desktop.
groovy(java)にて、SHA-1ハッシュを求める
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