summaryrefslogtreecommitdiff
path: root/src/Network/Tox/NodeId.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox/NodeId.hs')
-rw-r--r--src/Network/Tox/NodeId.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Network/Tox/NodeId.hs b/src/Network/Tox/NodeId.hs
index d5da692a..dc600db7 100644
--- a/src/Network/Tox/NodeId.hs
+++ b/src/Network/Tox/NodeId.hs
@@ -589,7 +589,8 @@ parseNoSpamJID jid = do
589 589
590solveBase64NoSpamID :: String -> PublicKey -> Either String NoSpamId 590solveBase64NoSpamID :: String -> PublicKey -> Either String NoSpamId
591solveBase64NoSpamID b64digits pub = do 591solveBase64NoSpamID b64digits pub = do
592 NoSpam nospam (Just x) <- readEither $ '$' : map (\case; '?' -> '0'; c -> c) b64digits 592 NoSpam nospam mx <- readEither $ '$' : map (\case; '?' -> '0'; c -> c) b64digits
593 maybe (const $ Left "missing checksum") (flip ($)) mx $ \x -> do
593 let nlo = fromIntegral (0x0FFFF .&. nospam) :: Word16 594 let nlo = fromIntegral (0x0FFFF .&. nospam) :: Word16
594 nhi = fromIntegral (0x0FFFF .&. (nospam `shiftR` 16)) :: Word16 595 nhi = fromIntegral (0x0FFFF .&. (nospam `shiftR` 16)) :: Word16
595 sum = x `xor` nlo `xor` nhi `xor` xorsum pub 596 sum = x `xor` nlo `xor` nhi `xor` xorsum pub