Sujet : Re: lun - Lucky Number
De : 333200007110-0201 (at) *nospam* ybtra.de (Marcel Logen)
Groupes : sci.cryptDate : 15. Mar 2025, 20:44:04
Autres entêtes
Organisation : Bureau Logen
Message-ID : <87senejdap.fsf@pc-731.ybtra.de>
References : 1 2 3 4 5 6 7 8
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Richard Heathfield in sci.crypt:
[...]
Tell you what, I'll let my source code do the talking and give
you a demo run at the end:
Thank you. Interesting.
tuwetest.c: gcc -o tuwetest tuwetest.c tuwe.c
>
#include "tuwe.h"
>
#include <stdio.h>
>
static void dump(const void *vb, int n)
{
int i = 0;
int j = 0;
const unsigned char * b = vb;
for(i = 0; i < n; i++)
{
for(j = 7; j >= 0; j--)
{
fprintf(stdout, "%d", !!(b[i] & (1 << j)));
^^
What does this do? Is it necessary?
(As you see, I'm not a C programmer. ;-)
}
putchar('\n');
}
printf("--------\n");
}
>
int main(void)
{
unsigned char t[8] = {31, 41, 59, 26, 53, 58, 97, 32};
unsigned char r[8] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned char l[8] = {0, 0, 0, 0, 0, 0, 0, 0};
>
puts("t first");
dump(t, 8);
puts("now turn it right 90 deg");
tuwer(r, t);
dump(r, 8);
puts("and back again");
tuwel(l, r);
dump(t, 8);
"dump(l, 8);" (?)
return 0;
}
[...]
#define BIT_QRY(x,i) ((x[(i)>>3] & (1<<((i)&7)))!=0)
#define BIT_SET(x,i) (x)[(i)>>3]|=(1<<((i)&7))
#define BIT_CLR(x,i) (x)[(i)>>3]&=(1<<((i)&7))^0xFF
Can you explain this a little bit?
Marcel
-- Sat Mar 15 20:44:04 2025 CET (1742067844)pc-73187 sene jdapLines: 67