-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathStreamCipherExample.pas
More file actions
52 lines (42 loc) · 2.05 KB
/
Copy pathStreamCipherExample.pas
File metadata and controls
52 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ *********************************************************************************** }
{ * CryptoLib Library * }
{ * Author - Ugochukwu Mmaduekwe * }
{ * Github Repository <https://github.com/Xor-el> * }
{ * * }
{ * Distributed under the MIT software license, see the accompanying file LICENSE * }
{ * or visit http://www.opensource.org/licenses/mit-license.php. * }
{ * * }
{ * Acknowledgements: * }
{ * * }
{ * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * }
{ * the development of this library * }
{ * ******************************************************************************* * }
(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
unit StreamCipherExample;
interface
{$IFDEF FPC}
{$MODE DELPHI}
{$HINTS OFF}
{$WARNINGS OFF}
{$ENDIF FPC}
uses
CipherExampleBase;
type
TStreamCipherExample = class(TSymmetricCipherExampleBase)
public
procedure Run; override;
end;
implementation
const
// Raw stream ciphers (no authentication). Add one by adding a row; each
// is driven through the same non-AEAD roundtrip as the block ciphers.
StreamSpecs: array[0..2] of TSymmetricSpec = (
(Algorithm: 'SALSA20'; DisplayName: 'Salsa20'; KeyByteCount: 32; IvByteCount: 8),
(Algorithm: 'CHACHA20'; DisplayName: 'ChaCha20'; KeyByteCount: 32; IvByteCount: 12),
(Algorithm: 'XCHACHA20'; DisplayName: 'XChaCha20'; KeyByteCount: 32; IvByteCount: 24)
);
procedure TStreamCipherExample.Run;
begin
RunSpecs('--- Stream cipher example: encrypt/decrypt ---', StreamSpecs);
end;
end.