Example usage for org.bouncycastle.pqc.math.linearalgebra ByteUtils xor

List of usage examples for org.bouncycastle.pqc.math.linearalgebra ByteUtils xor

Introduction

In this page you can find the example usage for org.bouncycastle.pqc.math.linearalgebra ByteUtils xor.

Prototype

public static byte[] xor(byte[] x1, byte[] x2) 

Source Link

Document

Compute the bitwise XOR of two arrays of bytes.

Usage

From source file:com.github.horrorho.inflatabledonkey.crypto.srp.SRPAssistant.java

License:Open Source License

public static byte[] generateM1(Digest digest, BigInteger N, BigInteger g, byte[] ephemeralKeyA,
        byte[] ephemeralKeyB, byte[] key, byte[] salt, // s
        byte[] identity) {

    // M1 = H(H(N) XOR H(g) | H(I) | s | A | B | K) 
    int length = length(N);

    // hI = H(I)/* ww  w .  ja  v a  2  s.  c  om*/
    byte[] hI = SRPAssistant.hash(digest, identity);

    // tmp = H(N) XOR H(g)
    byte[] hNxhG = ByteUtils.xor(SRPAssistant.hash(digest, padded(N, length)),
            SRPAssistant.hash(digest, padded(g, length)));

    return hash(digest, hNxhG, hI, salt, ephemeralKeyA, ephemeralKeyB, key);
}

From source file:com.github.horrorho.inflatabledonkey.crypto.srp.SRPCore.java

License:Open Source License

public static byte[] generateM1(Digest digest, BigInteger N, BigInteger g, byte[] ephemeralKeyA,
        byte[] ephemeralKeyB, byte[] key, byte[] salt, // s
        byte[] identity) {

    // M1 = H(H(N) XOR H(g) | H(I) | s | A | B | K) 
    int length = length(N);

    // hI = H(I)//from w  w w . jav a  2s .co  m
    byte[] hI = SRPCore.hash(digest, identity);

    // tmp = H(N) XOR H(g)
    byte[] hNxhG = ByteUtils.xor(SRPCore.hash(digest, padded(N, length)),
            SRPCore.hash(digest, padded(g, length)));

    return hash(digest, hNxhG, hI, salt, ephemeralKeyA, ephemeralKeyB, key);
}