This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use like: | |
sha1_attack --bytes 2 --type preimage | |
sha1_attack --bytes 4 --type collision | |
sha1_attack --bytes 3 --type both | |
--bytes is the number of bytes to consider (i.e. the number of bytes to which the SHA-1 digest will be truncated) | |
--type can be preimage, collision, or both |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Bits | |
modExp :: Integer -> Integer -> Integer -> Integer | |
modExp b 0 m = 1 | |
modExp b e m = t * modExp ((b * b) `mod` m) (shiftR e 1) m `mod` m | |
where t = if testBit e 0 then b `mod` m else 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Random | |
import Math.NumberTheory.Primes.Testing | |
rndPrime :: Int -> IO Integer | |
rndPrime bits = do | |
x <- fmap (.|. 1) $ randomRIO (2^(bits - 1), 2^bits - 1) | |
if isPrime x then return x else rndPrime bits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extendedEu :: Integer -> Integer -> (Integer, Integer) | |
extendedEu a 0 = (1, 0) | |
extendedEu a b = (t, s - q * t) | |
where (q, r) = quotRem a b | |
(s, t) = extendedEu b r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License: | |
// | |
// Copyright (c) 2010-2012, Joe Walnes | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget "https://gist.github.com/trevordixon/8413132/raw/index.html" -O /var/www/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset HelloWorldApp { | |
rule Excercise1 is active { | |
select when pageview ".*" | |
{ | |
notify("Hello World", "This is a sample rule.") with sticky = true; | |
notify("Another One", "Notification 2.") with sticky = true; | |
} | |
} | |
rule Exercise4 is active { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var angular = require('angular'); | |
module.exports = function LoginFormDirective ($compile) { | |
return { | |
restrict: 'E', | |
template: require('./loginFormTemplate.html'), | |
link: function (scope, element) { | |
// Already compiled! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a2294x1 { | |
rule show_form is active { | |
select when pageview "ktest\.heroku\.com" | |
pre { | |
firstName = ent:firstName; | |
lastName = ent:lastName; | |
form = << | |
<form id="simple_form"> | |
<input placeholder="First Name" name="first_name"><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a2294x2 { | |
rule first_rule is active { | |
select when pageview ".*" setting () | |
pre { | |
results = << | |
<dl id="results" style="display:none"> | |
<dt></dt> | |
<dd><img id="thumbnail" src=""></dd> | |
<dt>Title</dt> |