mirror of
https://codeberg.org/scip/twenty4.git
synced 2025-12-18 04:20:56 +01:00
initial commit
This commit is contained in:
BIN
sbox/BJNR000010949.epub
Normal file
BIN
sbox/BJNR000010949.epub
Normal file
Binary file not shown.
1
sbox/BJNR000010949.pass
Normal file
1
sbox/BJNR000010949.pass
Normal file
@@ -0,0 +1 @@
|
||||
grundgesetz
|
||||
19
sbox/Makefile
Normal file
19
sbox/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
LDFLAGS = -g
|
||||
CFLAGS = -g -Wall -Wextra -Werror
|
||||
DST = gen-static-sbox
|
||||
OBJS = gen-static-sbox.o
|
||||
|
||||
all: $(DST)
|
||||
|
||||
$(DST): $(OBJS)
|
||||
gcc $(LDFLAGS) $(OBJS) -o $(DST)
|
||||
|
||||
%.o: %.c
|
||||
gcc -c $(CFLAGS) $*.c -o $*.o
|
||||
|
||||
clean:
|
||||
rm -f *.o $(DST)
|
||||
|
||||
|
||||
sboxes:
|
||||
cat BJNR000010949.epub | openssl aes-256-cbc -kfile BJNR000010949.pass | ./$(DST)
|
||||
58
sbox/gen-static-sbox.c
Normal file
58
sbox/gen-static-sbox.c
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint32_t word;
|
||||
typedef uint16_t half;
|
||||
|
||||
#define MAX 4096
|
||||
|
||||
void dump256(byte *hash) {
|
||||
int i, b = 1;
|
||||
|
||||
for(i=0; i<256; i++) {
|
||||
fprintf(stderr, "0x%02x, ", hash[i]);
|
||||
if(b == 16) {
|
||||
fprintf(stderr, "\n");
|
||||
b = 1;
|
||||
}
|
||||
else
|
||||
b++;
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
int main() {
|
||||
byte raw[MAX];
|
||||
byte hash[256] = {0}, reg[256] = {0}, out;
|
||||
int i, b=0, has=0;
|
||||
|
||||
fread(raw, MAX, 1, stdin);
|
||||
|
||||
memset(hash, 0, 256);
|
||||
|
||||
for (i=0; i<MAX; i++) {
|
||||
out = raw[i];
|
||||
if(reg[out] == 0) {
|
||||
reg[out]++;
|
||||
hash[b++] = out;
|
||||
has++;
|
||||
}
|
||||
if(has == 256) {
|
||||
dump256(hash);
|
||||
has = b = 0;
|
||||
memset(hash, 0, 256);
|
||||
memset(reg, 0, 256);
|
||||
}
|
||||
}
|
||||
|
||||
//fwrite(hash, 256, 1, stdout);
|
||||
fprintf(stderr, "done\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user