Skip to content

Instantly share code, notes, and snippets.

View serhanozbey's full-sized avatar
🎯
Focusing

serhanozbey

🎯
Focusing
View GitHub Profile
@serhanozbey
serhanozbey / AESGCMUpdateAAD2.java
Created April 25, 2018 07:49 — forked from praseodym/AESGCMUpdateAAD2.java
JDK8 AES-GCM code example
import javax.crypto.*;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
public class AESGCMUpdateAAD2 {
// AES-GCM parameters
public static final int AES_KEY_SIZE = 128; // in bits
@serhanozbey
serhanozbey / Password.java
Created April 24, 2018 23:41 — forked from craSH/Password.java
A simple example Java class to safely generate and verify bcrypt password hashes for use in authentication systems.
/**
* Author: Ian Gallagher <igallagher@securityinnovation.com>
*
* This code utilizes jBCrypt, which you need installed to use.
* jBCrypt: http://www.mindrot.org/projects/jBCrypt/
*/
public class Password {
// Define the BCrypt workload to use when generating password hashes. 10-31 is a valid value.
private static int workload = 12;