View gist:319086
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 org.jboss.netty.channel.{ | |
ChannelPipelineCoverage, | |
SimpleChannelHandler, | |
ChannelHandlerContext, | |
MessageEvent, | |
ExceptionEvent | |
} | |
import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory | |
import org.jboss.netty.bootstrap.ConnectionlessBootstrap | |
import java.util.concurrent.Executors |
View legible_hash.rb
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
require 'sha1' | |
module LegibleHash | |
CHARS = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a - ['0', 'O', '1', 'I', 'l'] | |
def self.digest (str) | |
SHA1.digest(str).each_byte.map { |byte| CHARS[byte.modulo(CHARS.length)] }.join | |
end | |
end |