From 7ab09c43f0bb6f8f42c0156644869dfe78aa0b89 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 21 Oct 2017 22:01:16 -0400 Subject: Renamed Assym -> Asymm (short for asymmetric). --- src/Crypto/Tox.hs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/Crypto') 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 , Encrypted , Encrypted8(..) , type (∘)(..) - , Assym(..) - , getAssym - , getAliasedAssym - , putAssym - , putAliasedAssym + , Asymm(..) + , getAsymm + , getAliasedAsymm + , putAsymm + , putAliasedAsymm , Plain , encodePlain , decodePlain @@ -326,34 +326,34 @@ zeros24 = BA.take 24 zs where Nonce32 zs = zeros32 -- | `32` | sender's DHT public key | -- | `24` | nonce | -- | `?` | encrypted message | -data Assym a = Assym +data Asymm a = Asymm { senderKey :: PublicKey - , assymNonce :: Nonce24 - , assymData :: a + , asymmNonce :: Nonce24 + , asymmData :: a } deriving (Functor,Foldable,Traversable, Show) -instance Sized a => Sized (Assym a) where +instance Sized a => Sized (Asymm a) where size = case size of ConstSize a -> ConstSize $ a + 24 + 32 - VarSize f -> VarSize $ \Assym { assymData = x } -> f x + 24 + 32 + VarSize f -> VarSize $ \Asymm { asymmData = x } -> f x + 24 + 32 -- | Field order: senderKey, then nonce This is the format used by -- Ping/Pong/GetNodes/SendNodes. -- --- See 'getAliasedAssym' if the nonce precedes the key. -getAssym :: Serialize a => Get (Assym a) -getAssym = Assym <$> getPublicKey <*> get <*> get +-- See 'getAliasedAsymm' if the nonce precedes the key. +getAsymm :: Serialize a => Get (Asymm a) +getAsymm = Asymm <$> getPublicKey <*> get <*> get -putAssym :: Serialize a => Assym a -> Put -putAssym (Assym key nonce dta) = putPublicKey key >> put nonce >> put dta +putAsymm :: Serialize a => Asymm a -> Put +putAsymm (Asymm key nonce dta) = putPublicKey key >> put nonce >> put dta -- | Field order: nonce, and then senderKey. -getAliasedAssym :: Serialize a => Get (Assym a) -getAliasedAssym = flip Assym <$> get <*> getPublicKey <*> get +getAliasedAsymm :: Serialize a => Get (Asymm a) +getAliasedAsymm = flip Asymm <$> get <*> getPublicKey <*> get -putAliasedAssym :: Serialize a => Assym a -> Put -putAliasedAssym (Assym key nonce dta) = put nonce >> putPublicKey key >> put dta +putAliasedAsymm :: Serialize a => Asymm a -> Put +putAliasedAsymm (Asymm key nonce dta) = put nonce >> putPublicKey key >> put dta newtype SymmetricKey = SymmetricKey ByteString -- cgit v1.2.3