This module provides a set of cryptographic functions.
References:
Types
byte() = 0 ... 255 ioelem() = byte() | binary() | iolist() iolist() = [ioelem()]
Starts the crypto server.
Stops the crypto server.
Stops the crypto server.
Data = iolist() | binary()
Digest = binary()
Computes an MD5
message digest from Data
, where
the length of the digest is 128 bits (16 bytes).
Context = binary()
Creates an MD5 context, to be used in subsequent calls to
md5_update/2
.
md5_update(Context, Data) -> NewContext
Data = iolist() | binary()
Context = NewContext = binary()
Updates an MD5 Context
with Data
, and returns
a NewContext
.
Context = Digest = binary()
Finishes the update of an MD5 Context
and returns
the computed MD5
message digest.
Data = iolist() | binary()
Digest = binary()
Computes an SHA
message digest from Data
, where
the length of the digest is 160 bits (20 bytes).
XXX Should have sha_[init|update|finish] too.
Context = binary()
Creates an SHA context, to be used in subsequent calls to
sha_update/2
.
sha_update(Context, Data) -> NewContext
Data = iolist() | binary()
Context = NewContext = binary()
Updates an SHA Context
with Data
, and returns
a NewContext
.
Context = Digest = binary()
Finishes the update of an SHA Context
and returns
the computed SHA
message digest.
Key = Data = iolist() | binary()
Mac = binary()
Computes an MD5 MAC
message authentification code
from Key
and Data
, where the the length of the
Mac is 128 bits (16 bytes).
Key = Data = iolist() | binary()
Mac = binary()
Computes an MD5 MAC
message authentification code
from Key
and Data
, where the length of the Mac
is 96 bits (12 bytes).
Key = Data = iolist() | binary()
Mac = binary()
Computes an SHA MAC
message authentification code
from Key
and Data
, where the length of the Mac
is 160 bits (20 bytes).
Key = Data = iolist() | binary()
Mac = binary()
Computes an SHA MAC
message authentification code
from Key
and Data
, where the length of the Mac
is 96 bits (12 bytes).
des_cbc_encrypt(Key, IVec, Text) -> Cipher
Key = Text = iolist() | binary()
IVec = Cipher = binary()
Encrypts Text
according to DES in CBC mode. Text
must be a multiple of 64 bits (8 bytes). The lengths of Key
and IVec
must be 64 bits (8 bytes).
des_cbc_decrypt(Key, IVec, Cipher) -> Text
Key = Cipher = iolist() | binary()
IVec = Text = binary()
Decrypts Cipher
according to DES in CBC mode.
Cipher
must be a multiple of 64 bits (8 bytes).
The lengths of Key
and IVec
must be 64 bits (8 bytes).