Chaocipher: Difference between revisions

Content added Content deleted
(insert →‎Pascal)
(→‎Pascal: complete example)
Line 2,309: Line 2,309:
{ Determines whether a `map` contains all characters of `alphabet`. }
{ Determines whether a `map` contains all characters of `alphabet`. }
{ Nesting this function allows for a neat expression below. }
{ Nesting this function allows for a neat expression below. }
function isComplete(text: map): Boolean;
function isComplete(protected text: map): Boolean;
var
var
i: integer;
i: integer;
Line 2,418: Line 2,418:
{
{
\brief encrypts a message according to Chaocipher
\brief encrypts a message according to Chaocipher
\param line a message to encrypt
\param state the key to begin with
\return the encrypted message \param line using the provided key
}
}
{ Note: without `var` or `protected` both `encrypt` and `decrypt`get }
{ Note: without `var` or `protected` both `encrypt` and `decrypt`get }
Line 2,438: Line 2,441:
end;
end;


{
\brief decrypts a message according to Chaocipher
\param line the encrypted message
\param state the key to begin with
\return the decrypted message \param line using the provided key
}
function decrypt(line: message; state: key): message;
function decrypt(line: message; state: key): message;
function decryptor(protected i: messageCharacterIndex): mapCharacterIndex;
function decryptor(protected i: messageCharacterIndex): mapCharacterIndex;