# Cryptographic Postulates

*§1. Password Security - First Postulate*Let P be a password, key or hash, which will be used as input to one- way cryptographic function. Sequence of any characters of any non- zero size is described as A. Then it applies that if you supplement P by adding A, security will increase. (*)

*§2. Hash Security - Second Postulate*Let H1 be a one way hash function of original text T. Next we'll label as H2,H3...Hn various other one way hash functions of text T. Then it applies that if we replace H1 by function H = H1^H2[^H3^...^Hn] made of H1 a one or more functions, security will increase.

*§3. Cipher security - Third Postulate*Let T be the original text. Let's label C1 as encrypted T by algoritm A1 and key K1. Next we'll create C2 by encrypting C1 with different algoritm A2 a key K2. Then it applies, that if instead of C1 we use C2 created from it, security will increase.

*Notice:*
(*) This applies also when we add A, which is some function P. Also bigger the input is in comparison to output, the lesser is it's influence of additional increases.

(**) Operator ^ describes function of xor bytes on same position in output of one-way functions. Parentheses [ and ] describe optional values.

(***) This applies in similar method to following C3(K3),... Cn(Kn) while input is always previous output.

Necessary requirement of one-way cryptographic function is that during calculations it uses equivalent of original uncut input without loss of information. HMAC and PBKDF2 functions do not fulfill this under certain conditions! Which is why SafeNotes always securely treats input parameters before using these functions.

__Symbolically we can record/express postulates like this, while < marks
lower security:__

*§ 1. Password Security*```
P < P+A < P+A+A2 < ...
P < P+f(P)
P < P+P [example of use of very simple function f]
```

*§ 2. Hash Security*```
H1(T) < H1(T)^H2(T) < H1(T)^H2(T)^H3(T) < ...
H1(T) < H1(T)^H2(T) < H1(T)^H2(T+H1(T)) [§2 and §1]
```

*§ 3. Cipher Security*```
A1(T,K1) < A2(A1(T,K1),K2) < A3(A2(A1(T,K1),K2),K3) < ...
```

Cryptographic postulates are defined by the main author of SafeNotes. The encryption in the SafeNotes application is designed in accordance with these postulates.