Skip to content

Instantly share code, notes, and snippets.

@lolptdr
lolptdr / sha1_breaker.rb
Created September 10, 2014 01:51
Why you shouldn't use SHA1 to store your passwords!
require 'digest/sha1'
class SHA1Breaker
@@chars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ".split("")
@@nums = "1234567890".split("")
@@lower = "abcdefghijklmnopqrstuvwxyz".split("")
def self.breaker(hash)
self.guesser(hash, @@chars)
end
@lolptdr
lolptdr / RPS.rb
Created August 5, 2014 22:11
RPS ruby with terminal client program
class RPS
# Rock, Paper, Scissors
# Make a 2-player game of rock paper scissors. It should have the following:
#
# It is initialized with two strings (player names).
# It has a `play` method that takes two strings:
# - Each string reperesents a player's move (rock, paper, or scissors)
# - The method returns the winner (player one or player two)
# - If the game is over, it returns a string stating that the game is already over
# It ends after a player wins 2 of 3 games
def change a
smallcase = 'a'..'z' # smallcase.to_a.size #=> 26
zeros = ("%026d" % 0).chars # creates array of 26 zeros
check = Hash[smallcase.zip(zeros)] #create hash map of alphabet to zeros
b = a.chars.each {|x| x.downcase!}
b.each do |x|
if check.include?(x)
check[x] = 1
end