Save This Page
Home » openjdk-7 » com.sun.crypto » provider » [javadoc | source]
final class: RC2Crypt [javadoc | source]
Implementation of the RC2(tm) algorithm as described in RFC 2268. RC2 is a 16-bit based algorithm and not particularly fast on 32/64 bit architectures. Also, note that although the JVM has a 16-bit integer type (short), all expressions are evaluated either in 32 or 64 bit (int or long). Expression such as "s1 = s2 + s3" are implemented by first promoting s2 and s3 to int, performing an int addition, and then demoting the result back to short to store in s1. To avoid this fairly slow process, we use the int type throughout and manually insert "& 0xffff" where necessary.
Method from com.sun.crypto.provider.RC2Crypt Summary:
checkKey,   decryptBlock,   encryptBlock,   getBlockSize,   getEffectiveKeyBits,   init,   initEffectiveKeyBits
Methods from com.sun.crypto.provider.SymmetricCipher:
decryptBlock,   encryptBlock,   getBlockSize,   init
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.crypto.provider.RC2Crypt Detail:
 static  void checkKey(String algorithm,
    int keyLength) throws InvalidKeyException 
  void decryptBlock(byte[] in,
    int inOfs,
    byte[] out,
    int outOfs) 
  void encryptBlock(byte[] in,
    int inOfs,
    byte[] out,
    int outOfs) 
    Encrypt a single block. Note that in a few places we omit a "& 0xffff" and allow variables to become larger than 16 bit. This still works because there is never a 32 bit overflow.
 int getBlockSize() 
 int getEffectiveKeyBits() 
  void init(boolean decrypting,
    String algorithm,
    byte[] key) throws InvalidKeyException 
  void initEffectiveKeyBits(int effectiveKeyBits) 
    Initializes the effective key bit size. This method is a hook to allow RC2Cipher to initialize the effective key size.