]> gitweb @ CieloNegro.org - Lucu.git/commitdiff
updates for new Crypto and dataenc package
authorpho <pho@cielonegro.org>
Tue, 22 Jan 2008 10:22:02 +0000 (19:22 +0900)
committerpho <pho@cielonegro.org>
Tue, 22 Jan 2008 10:22:02 +0000 (19:22 +0900)
darcs-hash:20080122102202-62b54-cdccd1ec22879ffde371fbf45ef521360165806a.gz

ImplantFile.hs
Lucu.cabal
Network/HTTP/Lucu/Authorization.hs

index 22fafeaa5acd35d413c827701265aead3a0d2349..7410b5f4cde3803c44a652a179763ee749298660 100644 (file)
@@ -5,7 +5,7 @@ import           Data.Bits
 import qualified Data.ByteString.Lazy as Lazy (ByteString)
 import qualified Data.ByteString.Lazy as L hiding (ByteString)
 import           Data.Char
-import           Data.Digest.SHA1
+import           Data.Digest.SHA2
 import           Data.Int
 import           Data.Maybe
 import           Data.Time
@@ -408,7 +408,7 @@ getETag opts input
           _                -> error "too many --etag options."
     where
       mkETagFromInput :: String
-      mkETagFromInput = "SHA-1:" ++ (toHex $ hash $ L.unpack input)
+      mkETagFromInput = "SHA-1:" ++ (toHex $ toOctets $ sha256 $ L.unpack input)
 
       toHex :: [Word8] -> String
       toHex []     = ""
index 5ee1f72dfec01a0036b838a132a9e9fdd34901f4..0e307776b489327569b744815af1a60f9d01306e 100644 (file)
@@ -30,8 +30,8 @@ Flag build-lucu-implant-file
 
 Library
     Build-Depends:
-        Crypto, base, bytestring, containers, directory, haskell-src,
-        hxt, mtl, network, stm, time, unix, zlib
+        Crypto, base, bytestring, containers, dataenc, directory,
+        haskell-src, hxt, mtl, network, stm, time, unix, zlib
     Exposed-Modules:
         Network.HTTP.Lucu
         Network.HTTP.Lucu.Abortion
index bcc8003e408056a194f59c58ed876edb5a39bab1..b0b0e06c2d36deb8a7e66135976411eba5454375 100644 (file)
@@ -13,6 +13,7 @@ module Network.HTTP.Lucu.Authorization
     where
 
 import qualified Codec.Binary.Base64 as B64
+import           Data.Maybe
 import           Network.HTTP.Lucu.Parser
 import           Network.HTTP.Lucu.Parser.Http
 import           Network.HTTP.Lucu.Utils
@@ -59,7 +60,7 @@ authCredentialP = allowEOF $!
                                               c == '+' ||
                                               c == '/' ||
                                               c == '=')
-                     let decoded = map (toEnum . fromEnum) (B64.decode b64)
+                     let decoded = map (toEnum . fromEnum) (fromJust $ B64.decode b64)
                      case break (== ':') decoded of
                        (uid, ':' : password)
                            -> return (BasicAuthCredential uid password)