Table of provided algorithms - ivan-zaera/cipher GitHub Wiki

This page lists all provided algorithms, their characteristics, and supported initialization parameters (CipherParameters). A table with links related to each algorithm is also provided.

Note that all sizes are listed in bits when unit is not specified. Use the following table to convert from bits to bytes.

Unit equivalences

Bits 32 64 128 160 192 224 256 320 384 512 1024 2048 3072
Bytes 4 8 16 20 24 28 32 40 48 64 128 256 384

Table of characteristics

Block ciphers:

Name Block size Key sizes Supported parameters
AES 128 128, 192, 256 KeyParameter

Asymmetric block ciphers:

Name Input block size Output block size Key strength (compared to symmetric) Supported parameters Key types
RSA ~bitlength(N) ~bitlength(N) 3072 ~= 128
15360 ~= 256
AsymmetricKeyParameter
   <RSAAsymmetricKey>
Public: RSAPublicKey
Private: RSAPrivateKey
Base: RSAAsymmetricKey

Stream ciphers:

Name Key sizes Supported parameters
Salsa20 256 * ParametersWithIV<KeyParameter>:
   -IV must be 64 bits long

Block cipher modes of operation:

Name Supported parameters
CBC (Cipher Block Chaining) * ParametersWithIV<?>:
   -IV must be as long as cipher's block size
   -Underlying parameters are directly passed to the block cipher
CFB (Cipher FeedBack) * ParametersWithIV<?>:
   -IV should be as long as cipher's block size (otherwise it is prepended with 0's)
   -Underlying parameters are directly passed to the block cipher
* CipherParameters:
   -IV is initialized with 0's
   -The parameters are directly passed to the block cipher
CTR (CounTeR mode) * ParametersWithIV<?>:
   -IV should be as long as cipher's block size (otherwise it is suffixed with 0's)
   -Underlying parameters are directly passed to the block cipher
ECB (Electronic Code Book) * CipherParameters:
   -The parameters are directly passed to the block cipher
GCTR (GOST 28147 OFB CounTeR) * ParametersWithIV<?>:
   -IV should be as long as cipher's block size (otherwise it is prepended with 0's)
   -Underlying parameters are directly passed to the block cipher
* CipherParameters:
   -WARNING: THIS BEHAVIOR MAY CHANGE IN THE FUTURE TO REFLECT OTHER MODES' STANDARDS
   -reset() is called
   -IV is left intact
   -The parameters are directly passed to the block cipher
OFB (Output FeedBack) * ParametersWithIV<?>:
   -IV should be as long as cipher's block size (otherwise it is prepended with 0's)
   -Underlying parameters are directly passed to the block cipher
* CipherParameters:
   -IV is initialized with 0's
   -The parameters are directly passed to the block cipher

Paddings:

Name Supported parameters
PKCS7 No need to initialize

Digests:

Name Digest size
MD2 128
MD4 128
MD5 128
RIPEMD-128 128
RIPEMD-160 160
RIPEMD-256 256
RIPEMD-320 320
SHA-1 160
SHA-224 224
SHA-256 256
SHA-3 224, 256, 384, or 512
SHA-384 384
SHA-512 512
SHA-512/t from 8 to 504 in 8-bit increments (except 384)
Tiger 192
Whirlpool 512

MACs:

Name MAC size Supported parameters
HMAC That of the underlying digest * KeyParameter:
   -Key should be of the same length as the internal block length (not digest length!) of the underlying digest.
   -If the key is smaller it is suffixed with zeros.
   -If the key is longer it is digested to make it the digest's internal block size.

Signatures:

Name Supported parameters Key types Supported digests
ECDSA * ParametersWithRandom < PrivateKeyParameter < ECPrivateKey > >:
   -This type of CipherParameters can only be used for signing.
   -The SecureRandom is used for ephemeral k calculation.
   -The underlying PrivateKeyParameter is used as explained in the next lines.
* PrivateKeyParameter < ECPrivateKey > :
   -This type of CipherParameters can only be used for signing.
   -The private key used for signing.
* PublicKeyParameter < ECPublicKey > :
   -This type of CipherParameters can only be used for validating signatures.
   -The public key used for validation.
Public: ECPublicKey
Private: ECPrivateKey
Base: ECAsymmetricKey
Any
Deterministic ECDSA (RFC 6979) * PrivateKeyParameter < ECPrivateKey > :
   -This type of CipherParameters can only be used for signing.
   -The private key used for signing.
* PublicKeyParameter < ECPublicKey > :
   -This type of CipherParameters can only be used for validating signatures.
   -The public key used for validation.
Public: ECPublicKey
Private: ECPrivateKey
Base: ECAsymmetricKey
Any registered cipher digest
RSA (PKCS #1) * PrivateKeyParameter < ECPrivateKey > :
   -This type of CipherParameters can only be used for signing.
   -The private key used for signing.
* PublicKeyParameter < ECPublicKey > :
   -This type of CipherParameters can only be used for validating signatures.
   -The public key used for validation.
Public: RSAPublicKey
Private: RSAPrivateKey
Base: RSAAsymmetricKey
MD2, MD4, MD5, RIPEMD-128, RIPEMD-160, RIPEMD-256, SHA-1, SHA-225, SHA-256, SHA-384, SHA-512

Password based key derivators:

Name Supported parameters Derived keys size
PBKDF2 Pbkdf2Parameters As requested in the Pbkdf2Parameters
scrypt ScryptParameters As requested in the ScryptParameters

Asymmetric key generators:

Name Supported parameters
ECDSA * ParametersWithRandom < ECKeyGeneratorParameters > :
   -The SecureRandom used to generate the random key.
   -The ECKeyGeneratorParameters are used as explained in the following lines.
* ECKeyGeneratorParameters :
   -Contains the ECDomainParameters where the key must be contained.
RSA * ParametersWithRandom < RSAKeyGeneratorParameters > :
   -The SecureRandom used to generate the random key.
   -The RSAKeyGeneratorParameters are used as explained in the following lines.
* RSAKeyGeneratorParameters :
   -Contains the parameters to be used for key generation (like bit strength, public exponent, etc.).

Entropy sources (true RNGs):

Secure randoms (secure PRNGs):

Name Supported parameters Description
URL Not used Grabs binary bytes from a given URL. Each time getBytes() is called a new connection is made. Can be used with sites like random.org. It is advised to use HTTPS and only contact trusted sources. Use it at your own risk, as the security of the entropy source depends on the server you are contacting.
File Not used Grabs binary bytes from a given file. Each time getBytes() is called the file is reopened and read from the beginning. Can be used with local devices like /dev/random in Unix like operating systems.
Name Supported parameters Description
Block cipher used in CTR mode * ParametersWithIV < CipherParameters > :
   -The IV is used as the first value for CTR.    -The CipherParameters are directly passed to the underlying block cipher.
Uses a block cipher in CTR mode to encrypt increasing values or a counter to generate secure pseudo random numbers. It is useful to use an entropy source for the block cipher key and/or IV value.
Block cipher in CTR mode with auto seed ParametersWithIV < KeyParameter > :    -The IV is used as the first value for CTR.    -The KeyParameter is directly passed to the underlying block cipher.
Works as Block cipher used in CTR mode above but reseeds itself after every request. A reseed consists of a change in the IV and key with random values for from the PRNG itself. This technique provides forward security as explained in Practical Random Number Generation in Software by John Viega.
⚠️ **GitHub.com Fallback** ⚠️