Skip to content

Instantly share code, notes, and snippets.

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
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