Skip to content

Instantly share code, notes, and snippets.

//update of https://gist.github.com/scoroberts/a60d61a2cc3afba1e8813b338ecd1501
@Grab(group='com.google.guava', module='guava', version='31.1-jre')
@Grab(group='commons-codec', module='commons-codec', version='1.15')
@Grab(group='bouncycastle', module='bcprov-jdk15', version='140')
@Grab('software.amazon.cryptools:AmazonCorrettoCryptoProvider:1.+:linux-x86_64')
import groovy.transform.CompileStatic
import java.security.MessageDigest
import java.nio.charset.StandardCharsets
import com.google.common.hash.Hashing
@scoroberts
scoroberts / hash_comp.groovy
Created October 16, 2019 01:03
Test of different Java based SHA-256 hash implementations
@Grab(group='com.google.guava', module='guava', version='19.0')
@Grab(group='commons-codec', module='commons-codec', version='1.13')
@Grab(group='bouncycastle', module='bcprov-jdk15', version='140')
import groovy.transform.CompileStatic
import java.security.MessageDigest
import java.nio.charset.StandardCharsets
import com.google.common.hash.Hashing
import org.apache.commons.codec.digest.DigestUtils
import org.bouncycastle.crypto.digests.SHA256Digest
@scoroberts
scoroberts / jschAWSConnect.groovy
Last active December 17, 2015 11:49
Upload a file to a remote EC2 server through a NAT bastion gateway over SSH using JSch. Allows tunneling from A -> B, A -> C, A -> D, etc.
@Grab(group='com.jcraft', module='jsch', version='0.1.49')
import com.jcraft.jsch.*
//-------------------------- CONFIG ------------------------//
def gatewayServer = "ec2-gateway"
def gatewayUsername = "ec2-user"
def gatewayKeyPath = "/javadev/scripts/gateway.pem"
def gatewayPassword = ""