From: pho Date: Tue, 22 Jan 2008 10:22:02 +0000 (+0900) Subject: updates for new Crypto and dataenc package X-Git-Tag: RELEASE-0_2_1~11 X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=2321c55149b4fd126835b1d2f708007ca1ffcb85;p=Lucu.git updates for new Crypto and dataenc package darcs-hash:20080122102202-62b54-cdccd1ec22879ffde371fbf45ef521360165806a.gz --- diff --git a/ImplantFile.hs b/ImplantFile.hs index 22fafea..7410b5f 100644 --- a/ImplantFile.hs +++ b/ImplantFile.hs @@ -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 [] = "" diff --git a/Lucu.cabal b/Lucu.cabal index 5ee1f72..0e30777 100644 --- a/Lucu.cabal +++ b/Lucu.cabal @@ -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 diff --git a/Network/HTTP/Lucu/Authorization.hs b/Network/HTTP/Lucu/Authorization.hs index bcc8003..b0b0e06 100644 --- a/Network/HTTP/Lucu/Authorization.hs +++ b/Network/HTTP/Lucu/Authorization.hs @@ -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)