diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-07 18:49:15 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-07 18:51:09 -0400 |
commit | 07bd29a80ed36c63296214af34689d0cce14751f (patch) | |
tree | c22aa59dde551c5fb7f54f26e406c70dc441171f /Tunables.hs | |
parent | 6f2d6120533070ce48bbc1e12465d1f7d603aec8 (diff) | |
download | keysafe-07bd29a80ed36c63296214af34689d0cce14751f.tar.gz |
reorg, and working on serialization
Diffstat (limited to 'Tunables.hs')
-rw-r--r-- | Tunables.hs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/Tunables.hs b/Tunables.hs deleted file mode 100644 index 1806703..0000000 --- a/Tunables.hs +++ /dev/null @@ -1,50 +0,0 @@ -module Tunables where - -import Types -import Shard -import Cost -import qualified Crypto.Argon2 as Argon2 - -data Tunables = Tunables - { objectSize :: Int - , shardParams :: shardParams - -- ^ size of objects stored in keysafe, in bytes - , argonOptions :: Argon2.HashOptions - , argonCost :: Cost CreationOp - -- ^ should correspond to the argonOptions - , decryptionPuzzleCost :: Cost DecryptionOp - -- ^ cost of decryption puzzle - } - -defaultTunables :: Tunables -defaultTunables = Tunables - { shardParams = ShardParams { totalObjects = 3, neededObjects = 2 } - , objectSize = 1024*64 -- 64 kb - , argonOptions = Argon2.HashOptions - { Argon2.hashIterations = 10000 - , Argon2.hashMemory = 131072 -- 128 mebibtyes per thread - , Argon2.hashParallelism = 4 -- 4 threads - , Argon2.hashVariant = Argon2.Argon2i - } - -- argon2 is GPU and ASIC resistent, so it uses CPU time. - -- The above HashOptions were benchmarked at 661 seconds CPU time - -- on a 2 core Intel(R) Core(TM) i5-4210Y CPU @ 1.50GHz. - -- Since cost is measured per core, we double that. - , argonCost = CPUCost (Seconds (2*600)) - -- AES can be calculated more efficiently by a GPU, so this - -- cost is a GPU cost. - -- This is set to only 1 minute because GPUs are quite a lot - -- faster than CPUs at AES, and so setting it higher would make - -- clients too slow at key recovery. - , decryptionPuzzleCost = GPUCost (Seconds 60) - } - --- | Dials back cryptographic difficulty, not for production use. -testModeTunables :: Tunables -testModeTunables = Tunables - { shardParams = shardParams { totalObjects = 3, neededObjects = 2 } - , objectSize = 1024*64 - , argonOptions = Argon2.defaultHashOptions - , argonCost = CPUCost (Seconds (2*600)) - , decryptionPuzzleCost = GPUCost (Seconds 60) - } |