Objective: To have a very simple to verify, but very secure small message encryption.
Idea: Message ⊕ bcrypt( Password). We remove password biases with bcrypt
and then XOR resulting key with the Message.
Implementation.
Limitation: Only messages up to 320 characters long are supported.
10 bcrypt
salt values are hard coded:
- Salt1 =
$2a$12$geKv/Jdb2zSGEtnn3AuXXe
- Salt2 =
$2a$12$h1V42zCLf/F5F7RbueVuZe
- Salt3 =
$2a$12$UTX8OMvg1CI3/pnbT0F5Mu
- . . . . . . .
- Salt10 =
$2a$12$Yq9Vo0yefk6zJlEvJmBf6O
Suppose we have
Message=My safe code is 29540323, my bank card pin is 6926
Password= 32GateKeepers
The message is 50 characters long. bcrypt produces keys 32 characters long. So we need 2 keys to match message length:
Key1 = bcrypt(Password, Salt1) = e8.4zyJT9m9R/KX./Kd2juSHn25IqGUO
Key2 = bcrypt(Password, Salt2) = emTDJsUVCLFE3Jm8Cjx2S2/WmXEVrrU.
Key (50 characters) = e8.4zyJT9m9R/KX./Kd2juSHn25IqGUOemTDJsUVCLFE3Jm8Cj
Code = Message ⊕ Key = 40,65,14,71,27,31,47,116,90,2,93,55,15,34,43,14,29,114,81,6,90,70,97,123,66,18,88,48,81,37,52,33,14,77,55,37,56,23,117,38,42,34,102,44,64,106,91,1,113,92
Question: Is bcrypt
de-biasing good enough to use in XOR encryption?
Specific Problem: Attacker knows that the same password was hashed with ten known salts for longer messages.
Specific Question: If the attacker has 10 hashes of the same password with 10 known salts. Given the nature of hashes, does this weaken the password?