From 4d4e68ff1177b3173f7a7ce5ed98e5c7815a0acd Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 17 Sep 2015 16:06:50 +0200 Subject: [PATCH] greater hash size --- Handler/Avatar.hs | 2 +- Migration/0.0.0-0.0.1/Migration.hs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Handler/Avatar.hs b/Handler/Avatar.hs index b521fb5..67f7bc9 100644 --- a/Handler/Avatar.hs +++ b/Handler/Avatar.hs @@ -125,7 +125,7 @@ generateThumb raw = do setImageCompressionQuality w 95 setImageFormat w "png" getImageBlob w - let h = encode (SHA3.hash 8 thumb) + let h = encode (SHA3.hash 24 thumb) return (thumb, h) getGetAvatarR :: AvatarId -> Handler TypedContent diff --git a/Migration/0.0.0-0.0.1/Migration.hs b/Migration/0.0.0-0.0.1/Migration.hs index e9c037b..93f6f81 100644 --- a/Migration/0.0.0-0.0.1/Migration.hs +++ b/Migration/0.0.0-0.0.1/Migration.hs @@ -19,13 +19,13 @@ main = do dbPasswd <- getPasswd let dbString = "host=" ++ dbHost ++ " port=" ++ dbPort ++ " user=" ++ dbUser ++ " dbname=" ++ dbName ++ " password=" ++ dbPasswd conn <- connectPostgreSQL dbString - stmt1 <- prepare conn "select * from avatar where hash = 'fill_me!'" + stmt1 <- prepare conn "select * from avatar" _ <- execute stmt1 [] rows <- fetchAllRowsAL stmt1 tups <- return $ map (\entry -> case entry of [("id", theId), ("ident", _), ("data", SqlByteString theData), ("hash", _)] -> - [SqlByteString $ encode $ SHA3.hash 8 theData, theId] + [SqlByteString $ encode $ SHA3.hash 24 theData, theId] _ -> error "malformed entry" ) rows