cipherlib library

Implementations of cryptographic algorithms for encryption and decryption in pure Dart.

Classes

AEADCipher<C extends Cipher<CipherSink>, M extends MACHashBase<HashDigestSink>>
Provides support for AEAD (Authenticated Encryption with Associated Data) to the any Cipher with any MAC algorithm.
AEADCipherSink<C extends CipherSink, H extends HashDigestSink>
Extends the base AEADCipherSink to generate message digest for cipher algorithms.
AEADResult
The result from AEAD ciphers
AEADResultWithIV
The result from AEAD ciphers having an IV or nonce
AES
AES (Advanced Encryption Standard) is a symmetric encryption algorithm used for securing data. It operates on fixed-size blocks of data (128 bits) using keys of 128, 192, or 256 bits.
AESInCBCMode
Provides encryption and decryption for AES cipher in CBC mode.
AESInCBCModeDecrypt
Provides decryption for AES cipher in CBC mode.
AESInCBCModeDecryptSink
The sink used for decryption by the AESInCBCModeDecrypt algorithm.
AESInCBCModeEncrypt
Provides encryption for AES cipher in CBC mode.
AESInCBCModeEncryptSink
The sink used for encryption by the AESInCBCModeEncrypt algorithm.
AESInCFBMode
Provides encryption and decryption for AES cipher in CFB mode.
AESInCFBModeDecrypt
Provides decryption for AES cipher in CFB mode.
AESInCFBModeDecryptSink
The sink used for decryption by the AESInCFBModeDecrypt algorithm.
AESInCFBModeEncrypt
Provides encryption for AES cipher in CFB mode.
AESInCFBModeEncryptSink
The sink used for encryption by the AESInCFBModeEncrypt algorithm.
AESInCTRMode
Provides encryption and decryption for AES cipher in CTR mode.
AESInCTRModeCipher
Provides AES cipher in CTR mode.
AESInCTRModeSink
The sink used for both encryption and decryption by the AESInCTRModeCipher algorithm.
AESInECBMode
Provides encryption and decryption for AES cipher in ECB mode.
AESInECBModeDecrypt
Provides decryption for AES cipher in ECB mode.
AESInECBModeDecryptSink
The sink used for decryption by the AESInECBModeDecrypt algorithm.
AESInECBModeEncrypt
Provides encryption for AES cipher in ECB mode.
AESInECBModeEncryptSink
The sink used for encryption by the AESInECBModeEncrypt algorithm.
AESInGCMMode
Provides encryption and decryption for AES cipher in GCM mode.
AESInGCMModeDecrypt
Provides AES cipher in GCM mode for decryption.
AESInGCMModeDecryptSink
The sink used for both encryption and decryption by the AESInGCMModeDecrypt algorithm.
AESInGCMModeEncrypt
Provides AES cipher in GCM mode for encryption.
AESInGCMModeEncryptSink
The sink used for both encryption and decryption by the AESInGCMModeEncrypt algorithm.
AESInIGEMode
Provides encryption and decryption for AES cipher in IGE mode.
AESInIGEModeDecrypt
Provides decryption for AES cipher in IGE mode.
AESInIGEModeDecryptSink
The sink used for decryption by the AESInIGEModeDecrypt algorithm.
AESInIGEModeEncrypt
Provides encryption for AES cipher in IGE mode.
AESInIGEModeEncryptSink
The sink used for encryption by the AESInIGEModeEncrypt algorithm.
AESInOFBMode
Provides encryption and decryption for AES cipher in OFB mode.
AESInOFBModeCipher
Provides encryption for AES cipher in OFB mode.
AESInOFBModeSink
The sink used for encryption by the AESInOFBModeCipher algorithm.
AESInPCBCMode
Provides encryption and decryption for AES cipher in PCBC mode.
AESInPCBCModeDecrypt
Provides decryption for AES cipher in PCBC mode.
AESInPCBCModeDecryptSink
The sink used for decryption by the AESInPCBCModeDecrypt algorithm.
AESInPCBCModeEncrypt
Provides encryption for AES cipher in PCBC mode.
AESInPCBCModeEncryptSink
The sink used for encryption by the AESInPCBCModeEncrypt algorithm.
AESInXTSMode
Provides encryption and decryption for AES cipher in XTS mode.
AESInXTSModeDecrypt
Provides decryption for AES cipher in XTS mode.
AESInXTSModeDecryptSink
This implementation is derived from 1619-2018 - IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices.
AESInXTSModeEncrypt
Provides encryption for AES cipher in XTS mode.
AESInXTSModeEncryptSink
This implementation is derived from 1619-2018 - IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices.
ChaCha20
ChaCha20 is a stream cipher that uses a 256-bit key and a 64-bit nonce to generate a unique cipher stream for each messages.
ChaCha20Poly1305
ChaCha20-Poly1305 is a cryptographic algorithm combining ChaCha20 stream cipher for encryption and Poly1305 for generating message authentication code. It provides both confidentiality and integrity protection, making it a popular choice for secure communication protocols like TLS.
ChaCha20Sink
This sink is used by the ChaCha20 algorithm.
Cipher<S extends CipherSink>
Template for Cipher algorithm that uses the same logic for both encryption and decryption.
CipherBase
Template for all Cipher algorithms in this package
CipherSink
Template for Cipher algorithm sink.
CollateCipher<E extends Cipher<CipherSink>, D extends Cipher<CipherSink>>
Template for Cipher algorithm which does not use the same logic for encryption and decryption.
Nonce
Random initialization vector builder.
Nonce128
The 128-bit initialization vector builder.
Nonce64
The 64-bit initialization vector builder.
Padding
Padding is a process to extend the input message to match a specific block size to be used in the cryptographic algorithms.
Salsa20
Salsa20 is a stream cipher that uses a 256-bit key and a 64-bit nonce to generate a unique cipher stream for each messages.
Salsa20Poly1305
Salsa20-Poly1305 is a cryptographic algorithm combining the Salsa20 stream cipher for encryption and the Poly1305 for generating message authentication code.
Salsa20Sink
This sink is used by the Salsa20 algorithm.
SaltedCipher
Mixin to use a random initialization vector or salt with the Cipher
StreamCipherBase
Template for Cipher algorithm that uses the same logic for both encryption and decryption.
XChaCha20
XChaCha20 is a stream cipher that uses a 256-bit key and a 192-bit nonce to generate a unique cipher stream for each messages.
XChaCha20Poly1305
XChaCha20-Poly1305 is a cryptographic algorithm combining XChaCha20 stream cipher for encryption and Poly1305 for generating message authentication code.
XOR
XOR (exclusive or) cipher is a simple and lightweight method of encrypting data. It is often used for basic data obfuscation.
XSalsa20
XSalsa20 is a stream cipher that uses a 256-bit key and a 256-bit nonce to generate a unique cipher stream for each messages.
XSalsa20Poly1305
XSalsa20-Poly1305 is a cryptographic algorithm combining the XSalsa20 stream cipher for encryption and the Poly1305 for generating message authentication code.

Functions

chacha20(List<int> message, List<int> key, {List<int>? nonce, Nonce64? counter}) Uint8List
Apply ChaCha20 cipher with the follwing parameters:
chacha20poly1305(List<int> message, List<int> key, {List<int>? mac, List<int>? nonce, List<int>? aad, Nonce64? counter}) AEADResultWithIV
Encrypts or Decrypts the message using ChaCha20 cipher and generates an authentication tag with Poly1305.
chacha20Stream(Stream<int> stream, List<int> key, {List<int>? nonce, Nonce64? counter}) Stream<int>
Apply ChaCha20 cipher with the follwing parameters:
salsa20(List<int> message, List<int> key, {List<int>? nonce, Nonce64? counter}) Uint8List
Apply Salsa20 cipher with the follwing parameters:
salsa20poly1305(List<int> message, List<int> key, {List<int>? mac, List<int>? nonce, List<int>? aad, Nonce64? counter}) AEADResultWithIV
Encrypts or Decrypts the message using Salsa20 cipher and generates an authentication tag with Poly1305.
salsa20Stream(Stream<int> stream, List<int> key, {List<int>? nonce, Nonce64? counter}) Stream<int>
Apply Salsa20 cipher with the follwing parameters:
xchacha20(List<int> message, List<int> key, {List<int>? nonce, Nonce64? counter}) Uint8List
Apply XChaCha20 cipher with the follwing parameters:
xchacha20poly1305(List<int> message, List<int> key, {List<int>? mac, List<int>? nonce, List<int>? aad, Nonce64? counter}) AEADResultWithIV
Encrypts or Decrypts the message using XChaCha20 cipher and generates an authentication tag with Poly1305.
xchacha20Stream(Stream<int> stream, List<int> key, {List<int>? nonce, Nonce64? counter}) Stream<int>
Apply XChaCha20 cipher with the follwing parameters:
xor(List<int> message, List<int> key) Uint8List
Apply XOR cipher to the message using the key.
xorStream(Stream<int> stream, List<int> key) Stream<int>
Apply XOR cipher to the message stream using the key.
xsalsa20(List<int> message, List<int> key, {List<int>? nonce, Nonce64? counter}) Uint8List
Apply XSalsa20 cipher with the follwing parameters:
xsalsa20poly1305(List<int> message, List<int> key, {List<int>? mac, List<int>? nonce, List<int>? aad, Nonce64? counter}) AEADResultWithIV
Encrypts or Decrypts the message using XSalsa20 cipher and generates an authentication tag with Poly1305.
xsalsa20Stream(Stream<int> stream, List<int> key, {List<int>? nonce, Nonce64? counter}) Stream<int>
Apply XSalsa20 cipher with the follwing parameters: