greater hash size

This commit is contained in:
nek0 2015-09-17 16:06:50 +02:00
parent 3e783aafa2
commit 4d4e68ff11
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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