Extra Systems Block Cipher (ESBC)
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include "core.c"
int main(void)
{
unsigned char key_buf[128];
int file_handle;
file_handle=open("/dev/random", O_RDONLY);
read(file_handle, key_buf, sizeof(key_buf));
close(file_handle);
file_handle = creat("key.txt", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
write(file_handle, key_buf, sizeof(key_buf));
close(file_handle);
make_key_data(key_buf, sizeof(key_buf));
file_handle = open("src.txt", O_RDONLY);
read(file_handle, the_matrix, sizeof(the_matrix));
close(file_handle);
encode_matrix();
file_handle = creat("enc.txt", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
write(file_handle, the_matrix, sizeof(the_matrix));
close(file_handle);
decode_matrix();
file_handle = creat("dec.txt", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
write(file_handle, the_matrix, sizeof(the_matrix));
close(file_handle);
}
$ gcc -o test_esbc test_esbc.c
$ ./test_esbc
$ ls -la
total 60
drwxrwxr-x 2 xxxxxx xxxxxx 4096 Feb 26 12:32 .
drwxrwxr-x 13 xxxxxx xxxxxx 4096 Feb 24 16:52 ..
-rw-rw-r-- 1 xxxxxx xxxxxx 8173 Feb 25 23:20 core.c
-rw-r--r-- 1 xxxxxx xxxxxx 64 Feb 26 12:32 dec.txt
-rw-r--r-- 1 xxxxxx xxxxxx 64 Feb 26 12:32 enc.txt
-rw-r--r-- 1 xxxxxx xxxxxx 128 Feb 26 12:32 key.txt
-rw-rw-r-- 1 xxxxxx xxxxxx 64 Feb 25 15:07 src.txt
-rwxrwxr-x 1 xxxxxx xxxxxx 21328 Feb 26 12:32 test_esbc
-rw-rw-r-- 1 xxxxxx xxxxxx 911 Feb 25 18:04 test_esbc.c
$ xxd src.txt
00000000: 3031 3233 3435 3637 3839 6162 6364 6566 0123456789abcdef
00000010: 6768 696a 6b6c 6d6e 6f70 7172 7374 7576 ghijklmnopqrstuv
00000020: 777a 797a 4142 4344 4546 4748 494a 4b4c wzyzABCDEFGHIJKL
00000030: 4d4e 4f50 5152 5354 5556 5758 595a 3d0a MNOPQRSTUVWXYZ=.
$ xxd enc.txt
00000000: cb71 896a 7558 e9bf 67dd 1056 c95d afdb .q.juX..g..V.]..
00000010: 8e25 0466 e5fd 5e2d d37f f140 5076 263f .%.f..^-...@Pv&?
00000020: 4488 be0b b0f7 f85c f02c 4722 f5c7 ee4f D......\.,G"...O
00000030: d0db fe49 b344 ecbd 7cc2 b2cf ec63 1891 ...I.D..|....c..
$ xxd dec.txt
00000000: 3031 3233 3435 3637 3839 6162 6364 6566 0123456789abcdef
00000010: 6768 696a 6b6c 6d6e 6f70 7172 7374 7576 ghijklmnopqrstuv
00000020: 777a 797a 4142 4344 4546 4748 494a 4b4c wzyzABCDEFGHIJKL
00000030: 4d4e 4f50 5152 5354 5556 5758 595a 3d0a MNOPQRSTUVWXYZ=.
$ xxd key.txt
00000000: bad0 df96 cfb9 c7e2 7391 f9af fab5 47b9 ........s.....G.
00000010: e258 45e5 0957 c2a5 5a48 134e 9403 65b4 .XE..W..ZH.N..e.
00000020: b577 4fd0 cf98 0776 a832 9e20 4d08 63cc .wO....v.2. M.c.
00000030: 86b1 e41c 376b 8bc0 211b f130 415f a838 ....7k..!..0A_.8
00000040: 4c1d cb7e 4f65 e437 fe30 1a33 af7c 64de L..~Oe.7.0.3.|d.
00000050: 3ee4 910a 11e2 5718 78ea be6d 90e1 5b8f >.....W.x..m..[.
00000060: b51d 55fa 5f3c 9ad3 9408 fc73 ed95 c36e ..U._<.....s...n
00000070: ade2 93f5 5177 f952 9077 8b05 d6f3 4562 ....Qw.R.w....Eb
$
| © Extra Systems, 2026 |
|