Skip to content

Instantly share code, notes, and snippets.

View regisfoucault's full-sized avatar

Régis Foucault regisfoucault

View GitHub Profile
@regisfoucault
regisfoucault / gist:a6251db0286df6cd0c258d9d912620c5
Created October 30, 2017 14:33
Intercom Identity verification HMAC SH256
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
def encryptSHA256(message: String, secret: String): String = {
val sha256_HMAC = Mac.getInstance("HmacSHA256")
val secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256")
sha256_HMAC.init(secret_key)
sha256_HMAC.doFinal(message.getBytes())
.map("%02X" format _)
.mkString

Keybase proof

I hereby claim:

  • I am regisfoucault on github.
  • I am regisfoucault (https://keybase.io/regisfoucault) on keybase.
  • I have a public key whose fingerprint is 0CE2 9747 8F6F 7775 30BF 7497 1F7E 6C04 47A5 4697

To claim this, I am signing this object: