Parallel brute force: Difference between revisions
Content deleted Content added
Line 759:
import Control.Monad (replicateM, join)
import Control.Monad.Par (runPar, get, spawnP)
import Data.
import Data.Text.Encoding (encodeUtf8)▼
import Data.List.Split (chunksOf)
import Text.Printf (printf)
hashedValues :: [Digest SHA256]
Line 771:
]
wordVariations :: [
wordVariations =
bruteForce :: Int -> [
bruteForce n xs = runPar $ join <$> (mapM get =<< mapM (spawnP . foldr findMatch []) chunks)
where
chunks = chunksOf (26^5 `div` n) xs
findMatch s accum
| hashed `elem` hashedValues = (show hashed,
| otherwise = accum
where
hashed = hashWith SHA256 str
main :: IO ()
|