diff options
author | joe <joe@jerkface.net> | 2017-10-21 22:01:16 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-21 22:01:16 -0400 |
commit | 7ab09c43f0bb6f8f42c0156644869dfe78aa0b89 (patch) | |
tree | 760fb412fe55e7de11e5011a1f54f1f4ee5afefb /src/Crypto/Tox.hs | |
parent | cbdcc6500d6bda9948268312fc0bfb17955e53c5 (diff) |
Renamed Assym -> Asymm (short for asymmetric).
Diffstat (limited to 'src/Crypto/Tox.hs')
-rw-r--r-- | src/Crypto/Tox.hs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/Crypto/Tox.hs b/src/Crypto/Tox.hs index 645ca53e..ed8ec59e 100644 --- a/src/Crypto/Tox.hs +++ b/src/Crypto/Tox.hs | |||
@@ -20,11 +20,11 @@ module Crypto.Tox | |||
20 | , Encrypted | 20 | , Encrypted |
21 | , Encrypted8(..) | 21 | , Encrypted8(..) |
22 | , type (∘)(..) | 22 | , type (∘)(..) |
23 | , Assym(..) | 23 | , Asymm(..) |
24 | , getAssym | 24 | , getAsymm |
25 | , getAliasedAssym | 25 | , getAliasedAsymm |
26 | , putAssym | 26 | , putAsymm |
27 | , putAliasedAssym | 27 | , putAliasedAsymm |
28 | , Plain | 28 | , Plain |
29 | , encodePlain | 29 | , encodePlain |
30 | , decodePlain | 30 | , decodePlain |
@@ -326,34 +326,34 @@ zeros24 = BA.take 24 zs where Nonce32 zs = zeros32 | |||
326 | -- | `32` | sender's DHT public key | | 326 | -- | `32` | sender's DHT public key | |
327 | -- | `24` | nonce | | 327 | -- | `24` | nonce | |
328 | -- | `?` | encrypted message | | 328 | -- | `?` | encrypted message | |
329 | data Assym a = Assym | 329 | data Asymm a = Asymm |
330 | { senderKey :: PublicKey | 330 | { senderKey :: PublicKey |
331 | , assymNonce :: Nonce24 | 331 | , asymmNonce :: Nonce24 |
332 | , assymData :: a | 332 | , asymmData :: a |
333 | } | 333 | } |
334 | deriving (Functor,Foldable,Traversable, Show) | 334 | deriving (Functor,Foldable,Traversable, Show) |
335 | 335 | ||
336 | instance Sized a => Sized (Assym a) where | 336 | instance Sized a => Sized (Asymm a) where |
337 | size = case size of | 337 | size = case size of |
338 | ConstSize a -> ConstSize $ a + 24 + 32 | 338 | ConstSize a -> ConstSize $ a + 24 + 32 |
339 | VarSize f -> VarSize $ \Assym { assymData = x } -> f x + 24 + 32 | 339 | VarSize f -> VarSize $ \Asymm { asymmData = x } -> f x + 24 + 32 |
340 | 340 | ||
341 | -- | Field order: senderKey, then nonce This is the format used by | 341 | -- | Field order: senderKey, then nonce This is the format used by |
342 | -- Ping/Pong/GetNodes/SendNodes. | 342 | -- Ping/Pong/GetNodes/SendNodes. |
343 | -- | 343 | -- |
344 | -- See 'getAliasedAssym' if the nonce precedes the key. | 344 | -- See 'getAliasedAsymm' if the nonce precedes the key. |
345 | getAssym :: Serialize a => Get (Assym a) | 345 | getAsymm :: Serialize a => Get (Asymm a) |
346 | getAssym = Assym <$> getPublicKey <*> get <*> get | 346 | getAsymm = Asymm <$> getPublicKey <*> get <*> get |
347 | 347 | ||
348 | putAssym :: Serialize a => Assym a -> Put | 348 | putAsymm :: Serialize a => Asymm a -> Put |
349 | putAssym (Assym key nonce dta) = putPublicKey key >> put nonce >> put dta | 349 | putAsymm (Asymm key nonce dta) = putPublicKey key >> put nonce >> put dta |
350 | 350 | ||
351 | -- | Field order: nonce, and then senderKey. | 351 | -- | Field order: nonce, and then senderKey. |
352 | getAliasedAssym :: Serialize a => Get (Assym a) | 352 | getAliasedAsymm :: Serialize a => Get (Asymm a) |
353 | getAliasedAssym = flip Assym <$> get <*> getPublicKey <*> get | 353 | getAliasedAsymm = flip Asymm <$> get <*> getPublicKey <*> get |
354 | 354 | ||
355 | putAliasedAssym :: Serialize a => Assym a -> Put | 355 | putAliasedAsymm :: Serialize a => Asymm a -> Put |
356 | putAliasedAssym (Assym key nonce dta) = put nonce >> putPublicKey key >> put dta | 356 | putAliasedAsymm (Asymm key nonce dta) = put nonce >> putPublicKey key >> put dta |
357 | 357 | ||
358 | newtype SymmetricKey = SymmetricKey ByteString | 358 | newtype SymmetricKey = SymmetricKey ByteString |
359 | 359 | ||