Skip to content

Instantly share code, notes, and snippets.

package uk.co.blackcat;
import com.google.common.hash.Hashing;
import io.jsonwebtoken.*;
import io.jsonwebtoken.lang.Maps;
import io.jsonwebtoken.security.Keys;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.util.Map;

Keybase proof

I hereby claim:

  • I am mattjtodd on github.
  • I am mattjtodd (https://keybase.io/mattjtodd) on keybase.
  • I have a public key ASBreTYgPaQTcTwfhD11iiUFbwVGWJ3D0m_PjIPRFnnbzAo

To claim this, I am signing this object:

import com.google.common.hash.Hashing;
import com.google.common.hash.HashingInputStream;
import java.io.FileInputStream;
public class App {
public static void main(String[] args) throws Exception {
// read a file, create a hashing stream for SHA-256
try (HashingInputStream hashingInputStream = new HashingInputStream(Hashing.sha256(), new FileInputStream("/Users/matttodd/dev/personal/file-digest/hello2.txt"))) {
// read the stream fully to calculate hash
@mattjtodd
mattjtodd / fluentb.conf
Created May 30, 2018 13:06
FluentBit configuration for elastic JSON message output
[SERVICE]
Flush 1
Daemon Off
Log_Level info
Parsers_File /fluent-bit/etc/parsers.conf
[INPUT]
Name forward
Listen 0.0.0.0
Port 24224
@mattjtodd
mattjtodd / JavaPasswordSecurity.java
Created May 27, 2016 09:33 — forked from jtan189/JavaPasswordSecurity.java
Java PBKDF2 Password Hashing Code
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'