If there was a Clojure -> LLVM -> CUDA pipeline... Sorry just thinking
about possibilities
On Jun 16, 2013 3:19 AM, "Jim - FooBar();" <[email protected]> wrote:
> Hi guys,
>
> I tried for fun to write a parallel brute-force password cracker. I
> particularly thought that if I can generate lazily all the possible
> combinations, I'll have no trouble finding the match (memory-wise).
> something like this:
>
> (def token-types "All the possible characters grouped."
> {:numbers (->> 10 range (apply str) seq)
> :letters {:upper (seq "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
> :lower (seq "abcdefghijklmnopqrstuvwxyz")}
> :punctuation (seq ".,?!-")
> :arithmetic (seq "+-*/%=")
> :fancy (seq "@#$^&()~")} )
>
> (definline generic-pred "" [tester candidate]
> `(when-let [x# (~tester ~candidate)] x#))
>
> (defn brute-force "Tries a brute-force attack of a collection of the
> specified size. check-pred should return the match when it finds one,
> otherwise nil."
> ([target-size check-pred & possibilities]
> (let [all-poss (reduce #(into % (get-in token-types (-> %2 list flatten)
> :numbers)) #{} possibilities)
> perms (combi/selections all-poss target-size)
> answers *(help/pool-map check-pred perms 4)*]
> (some #(when % %) answers)))
> ([check-pred possibilities]
> (apply brute-force 4 check-pred possibilities)) )
>
> (defn pred-builder "Predicate builder" [^String target-value]
> (partial generic-pred
> #(when (= % (seq target-value))
> (apply str %))))
>
> (def PIN-pred "a dummy predicate for PINs. Returns the matching PIN"
> (pred-builder "6427"));;example PIN
>
>
> Now, no matter what mapping fn I choose, there is going to be an GC memory
> limit exceeded error, if I try it with more than 6-7 characters. My
> pool-map simply submit jobs to executors and polls for results lazily (in a
> 'for'). I also tried r/foldcat but the same error appears after a while.
>
> Of course now someone is going to say that this is not the right approach
> for password cracking. Ideally you want to stop searching as soon as you
> find a match. But that approach is not really parallelisable.
>
> I thought that laziness would save me here but instead it's biting me!
> any ideas anyone?
>
> btw, for sizes less than 8 it's quite fast!
>
> thanks in advance,
>
> Jim
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.