Rocksolid Light

OCTADE

mail  files  register  groups  login

Message-ID:  


USENET / sci.crypt / Re: MARC stream cipher

Re: MARC stream cipher

<urpm3p$a2sa$1@i2pn2.org>

  copy mid

https://news.octade.net/USENET/article-flat.php?id=202&group=sci.crypt#202

  copy link   Newsgroups: sci.crypt
Path: i2pn2.org!.POSTED!not-for-mail
From: ftilojim@tznvy.pbz (Chax Plore)
Newsgroups: sci.crypt
Subject: Re: MARC stream cipher
Date: Thu, 29 Feb 2024 11:26:00 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <urpm3p$a2sa$1@i2pn2.org>
References: <uriav2$6v5$1@i2pn2.org>
Reply-To: ftilojim@tznvy.pbz
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Feb 2024 10:26:02 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="330634"; mail-complaints-to="usenet@i2pn2.org";
posting-account="5D73dK+H7GjKFvIMhrW+/Y4rYhlPmfLmJxEmTeWyt8M";
X-Spam-Checker-Version: SpamAssassin 4.0.0
Content-Language: en-GB
In-Reply-To: <uriav2$6v5$1@i2pn2.org>
 by: Chax Plore - Thu, 29 Feb 2024 10:26 UTC

Here 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------

SubjectRepliesAuthor
o MARC stream cipher

By: Chax Plore on Mon, 26 Feb 2024

3Chax Plore

rocksolid light 0.9.152
clearnet tor