γγΎ
πΏ
A cryptosystem δ½οΌ
π§ͺ
γγΎ (also called Komatta) is an utility / library which implements a fast (yet to be tested) cryptosystem: encryption, integrity (signed or unsigned).
γ©γγγ£γ¦οΌ
π€
As its primitives, it uses Blake3
for the keyed hash
function (not using the Blake3
's native keyed hash) and Argon2
.
subkey
is an Argon2
of random salt || symmetric key
Cypher
π‘
It's symmetric and variable-length. Here is a brief explanation of how the mechanism works:
- A random
iv
is generated - Input is divided in blocks of length equal to the
block size
to get theplain blocks
- Create an array of byte arrays
cyphered blocks
where the encrypted blocks will be stored - Enumerate and iterate
plain blocks
(offset
,block
):- Get the
last cyphered block
fromcyphered blocks
(if the array is empty, this value will be the keyed hash ofiv
usingsubkey
as the key) - Calculate the keyed hash of
offset
usingsub key
as the key to get thecounter
counter
will be now equal tocounter β¨ last cyphered block
(ifcounter > last cyphered block
,last cyphered block
is repeated until both are the same length) (ifcounter < last cyphered block
,last cyphered block
's latest elements will be popped out of the array until both are the same length)- Calculate
block β¨ counter
to getcyphertext
(ifblock length > counter length
,counter
is repeated until both are the same length) (ifblock length < counter length
,counter
's latest elements will be popped out of the array until both are the same length) - Push
cyphertext
tocyphered blocks
- Get the
- Concatenate all the
cyphered blocks
's arrays
Integrity
π
input
is block size || integrity kind || iv || cyphertext
Signed
Signatures are generated using Dilithium5
with an input
and a previously generated keypair
. Using signed integrity can achieve:
- Integrity
- Authenticity
Unsigned
Unsigned integrity is achieved by calculating a keyed hash of input
using subkey
as the key. Using unsigned integrity can achieve:
- Integrity
Authenticity
ηΊι
π§βπ»
γͺγΉγγθ‘γ
πΈ
γγγγͺγοΌ