2022-07-01
Note:
This is a "quick how-to".
The instructions are subjectively reduced to a minimum, to keep focus and clarity.
unzip -o __ARCHIVE__.zip
OR
7z x -y __ARCHIVE__.zip
(optional) Verify the checksums against the official checksum values.
Do not use checksums from unknown sources.
(optional) On Linux: chmod +x bin/*
or chmod u+x bin/*
.
The --help
command line argument can be used.
Note: Replace the sample values for Chaos/Seed/Rounds and files with your values.
Find Chaos values with small number of conflicts between lines. A line is used as one string.
4x methods are faster and sometimes better for long strings.
hazy --sc -i dictionary-file.txt -s 0x12345678 --cl 50 -m sma4
hazy --sc -i dictionary-file.txt -s 0x12345678 --cl 50 -m shams
# // ----------------------------------------
# // using a text file - generate one now, for demo
# // using a short Chaos key - only to show it is possible
# // long keys should be used for sensitive data
echo "
Binary or text content.
Line with words.
" > binary-file
lsrec -l
# // encrypt a text file
hazy -r 2 -s 0x12345678 -c 0x87654321 -a -i binary-file -o secret-file
# // backup or send "secret-file"
# // decrypt on the other side
hazy -r 2 -s 0x12345678 -c 0x87654321 -a -i secret-file -o decrypted-file
diff -qs binary-file decrypted-file
cat decrypted-file
# // pipes can also be used
cat secret-file | hazy -r 2 -s 0x12345678 -c 0x87654321 -a | cat > decrypted-file
diff -qs binary-file decrypted-file
cat decrypted-file
# // standard redirects can also be used
hazy -r 2 -s 0x12345678 -c 0x87654321 -a <secret-file >decrypted-file
diff -qs binary-file decrypted-file
cat decrypted-file
Choose: Seed, Chaos key, Rounds, Method.
Use several 32bit hex non-zero numbers, with "0x" prefix.
Chaos chunks should not be "0". You may use "0", but this makes guessing decryption a bit easier.
A text or binary file can be used as input.
However, using random numbers for the key would be even better.
# // ----------------------------------------
# // using a longer Chaos key
# // using a bigger binary file - generate one now, for demo
truncate --size 12MB binary-file && shred -x -n 1 binary-file
lsrec -l
# // create a long chaos/key
echo -n "My Ultimate Long Password, text to remember, shared only with my friend!" | \
hazy --hk
# // create a long chaos/key - another good way
echo -n "My Ultimate Long Password, text to remember, shared only with my friend!" | \
hazy --hk --rev
# // create a long chaos/key - another good way
echo -n "My Ultimate Long Password, text to remember, shared only with my friend!" | \
od -A n -t x4 | \
sed -e 's/ 0000\w*//g;s/ / 0x/g;'
# // pick one method and create the chaos/key file
echo -n "My Ultimate Long Password, text to remember, shared only with my friend!" | \
hazy --hk > MyChaosKey.txt
lsrec -l
Default seed value is "0x0".
# // encrypt without seed
hazy -r 2 -m sma4 --cf MyChaosKey.txt -a -i binary-file -o secret-file
# // backup or send "secret-file"
# // decrypt on the other side
hazy -r 2 -m sma4 --cf MyChaosKey.txt -a -i secret-file -o decrypted-file
diff -qs binary-file decrypted-file
# // pipes can also be used
cat secret-file | hazy -r 2 -m sma4 --cf MyChaosKey.txt -a | cat > decrypted-file
diff -qs binary-file decrypted-file
# // standard redirects can also be used
hazy -r 2 -m sma4 --cf MyChaosKey.txt -a <secret-file >decrypted-file
diff -qs binary-file decrypted-file
Use one 32bit hex value for the seed.
# // (optional) create a seed file
echo -n 0x12345678 | tee MySeed.txt
# // encrypt with seed
hazy -r 2 -m sma4 --sf MySeed.txt --cf MyChaosKey.txt -a -i binary-file -o secret-file
# // backup or send "secret-file" and the seed
# // decrypt on the other side
hazy -r 2 -m sma4 --sf MySeed.txt --cf MyChaosKey.txt -a -i secret-file -o decrypted-file
diff -qs binary-file decrypted-file
Note: The "next seed" value can be used to encrypt the next file. When these files are concatenated in the same order, the resulting file can be decrypted in one step. However, there are a few other things to consider when using encrypted file concatenation.