OCTADE |
mail  files  register  groups  login |
<urpm3p$a2sa$1@i2pn2.org>
copy midhttps://news.octade.net/USENET/article-flat.php?id=202&group=sci.crypt#202
copy link Newsgroups: sci.cryptHere is the source code I cooked up:
unit MARC;
interface
type
MarcState = record
i, j, k: Byte;
S: array[0..255] of byte;
end;
procedure MarcInit(var State: MarcState; const KeyData; const KeyLength:
Integer);
function MarcLong(var State: MarcState): LongWord;
implementation
procedure MarcInit(var State: MarcState; const KeyData; const KeyLength:
Integer);
var
Key: array[0..1] of byte absolute KeyData;
temp: byte;
r: integer;
begin
with State do
begin
for r := 0 to 255 do
S[r] := Byte(r);
i := 0;
j := 0;
k := 0;
for r := 0 to 575 do
begin
j := j + S[i] + Key[i mod KeyLength];
k := k xor j;
temp := S[i];
S[i] := S[j];
S[j] := S[k];
S[k] := temp;
Inc(i);
end;
i := j + k;
end;
end;
procedure SwapByte(var A, B: Byte);
var
C: Byte;
begin
C := A;
A := B;
B := C;
end;
function MarcLong(var State: MarcState): LongWord;
var
A: array[1..4] of byte absolute result;
m, n: byte;
begin
with State do
begin
inc(i);
j := j + S[i];
k := k xor j;
swapbyte(S[i], S[j]);
m := S[j] + S[k];
n := S[i] + S[j];
A[4] := S[m];
A[3] := S[n];
A[2] := S[m xor j];
A[1] := S[n xor k];
end;
end;
On 2024-02-26 16:32, Chax Plore wrote:
>
> "MARC: modified ARC4", Jianliang Zheng, Jie Li.
>
> Conference: Proceedings of the 5th international conference on
> Foundations and Practice of Security.
>
> DOI:10.1007/978-3-642-37119-6_3
>
> I also want to confirm my test vectors of MARC, which I calculated using
> my own implementation - I will be grateful if someone checks my vectors
> (the paper provided no vectors):--
-----BEGIN PGP PUBLIC KEY FINGERPRINT-----
5745 807C 2B82 14D8 AB06 422C 8876 5DFC 2A51 778C
------END PGP PUBLIC KEY FINGERPRINT------
Subject | Replies | Author |
MARC stream cipher By: Chax Plore on Mon, 26 Feb 2024 | 3 | Chax Plore |