Created
April 5, 2016 22:41
-
-
Save barata0/6aeae48bc21b9d626e28afe133c5ce6f to your computer and use it in GitHub Desktop.
generate a SHA256 encoded as Base64
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
@Grapes( | |
@Grab(group='commons-codec', module='commons-codec', version='1.10') | |
) | |
import java.security.* | |
import java.util.Base64; | |
def file = new File('c:/users/danielr/Downloads/mortalkombat.mp4') | |
FileInputStream fis = new FileInputStream(file); | |
def md5 = org.apache.commons.codec.digest.DigestUtils.sha256(fis); | |
fis.close() | |
println md5 | |
String encoded = Base64.getEncoder().encodeToString(md5); | |
println encoded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment