org.bouncycastle.crypto.engines.BlowfishEngine Java Examples

The following examples show how to use org.bouncycastle.crypto.engines.BlowfishEngine. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RTMPHandshake.java    From red5-server-common with Apache License 2.0 5 votes vote down vote up
/**
 * RTMPE type 9 uses Blowfish on the regular signature http://en.wikipedia.org/wiki/Blowfish_(cipher)
 * 
 * @param array array to get signature
 * @param offset offset to start from
 * @param keyid ID of XTEA key
 */
public final static void getBlowfishSignature(byte[] array, int offset, int keyid) {
    BlowfishEngine bf = new BlowfishEngine();
    // need to use little endian
    bf.init(true, new KeyParameter(BLOWFISH_KEYS[keyid]));
    byte[] output = new byte[8];
    bf.processBlock(array, offset, output, 0);
    System.arraycopy(output, 0, array, offset, 8);
}
 
Example #2
Source File: BlowfishCipher.java    From panama with MIT License 3 votes vote down vote up
/**
 * <b>Notice: </b><br>
 * 1. in <code>new CFBBlockCipher(engine, <b>8</b> * 8);</code> the IV length (8) is
 * reference to the shadowsocks's design.
 *
 * @see <a href="https://shadowsocks.org/en/spec/cipher.html">
 * https://shadowsocks.org/en/spec/cipher.html</a>#Cipher
 */
public BlowfishCipher(String password, int mode) {
    key = new SecretKeySpec(password.getBytes(), "BF");
    keyLength = mode;
    BlowfishEngine engine = new BlowfishEngine();
    cipher = new CFBBlockCipher(engine, 8 * 8);
}
 
Example #3
Source File: BlowfishCipher.java    From AgentX with Apache License 2.0 3 votes vote down vote up
/**
 * <b>Notice: </b><br>
 * 1. in <code>new CFBBlockCipher(engine, <b>8</b> * 8);</code> the IV length (8) is
 * reference to the shadowsocks's design.
 *
 * @see <a href="https://shadowsocks.org/en/spec/cipher.html">
 * https://shadowsocks.org/en/spec/cipher.html</a>#Cipher
 */
public BlowfishCipher(String password, int mode) {
    key = new SecretKeySpec(password.getBytes(), "BF");
    keyLength = mode;
    BlowfishEngine engine = new BlowfishEngine();
    cipher = new CFBBlockCipher(engine, 8 * 8);
}