longshot-0.1.0.6: Fast Brute-force search using parallelism
LicenseMIT
MaintainerFrancis Lim <thyeem@gmail.com>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Crypto.Longshot.Internal

Description

 
Synopsis

Documentation

bruteforce :: Int -> String -> String -> Hasher -> Maybe String Source #

Brute-force search only for a given exact length

+----------+----------------------------------------------------------------------+
|     size | Preimage length to search                                            |
+----------+----------------------------------------------------------------------+
|    chars | Given character set like "0123456789"                                |
+----------+----------------------------------------------------------------------+
|      hex | Given hex-string like "17da1ae431f965d839ec8eb93087fb2b"             |
+----------+----------------------------------------------------------------------+
|   hasher | Hash functions in Hasher module. Get it using getHasher          |
+----------+----------------------------------------------------------------------+
|  numBind | Number of bound variables defined by search length and prefix size   |
+----------+----------------------------------------------------------------------+
|   runPar | A partially applied function for parallel execution                  |
+----------+----------------------------------------------------------------------+
| prefixes | All possible combinations of given prefix characters.                |
|          | The search space is equally partitioned based on these prefixes.     |
|          | length of prefixes == number of sparks                               |
+----------+----------------------------------------------------------------------+

bruteforceDeep :: String -> String -> Hasher -> Maybe String Source #

Incrementally searches without knowing the exact length of search

See the bruteforce function for the arguments used

bruteforcePar :: Int -> [ByteString] -> ByteString -> Hasher -> ByteString -> Maybe String Source #

Pick up an appropriate search function

Returns a partial application corresponding to the given numBind

(<%>) :: (NFData a, NFData b) => (a -> b) -> [a] -> [b] Source #

Parallel map using deepseq, par and pseq

Type of any argument in this map should be an instance of NFData.

image :: String -> ByteString Source #

Image bytestring: target hash value to find

byteChars :: String -> [ByteString] Source #

Bytestring usable for preimage

bytePrefixes :: Int -> String -> [ByteString] Source #

Combination of prefixes possible: size of (length of chars) ^ (numPrefix)