Skip to content

Instantly share code, notes, and snippets.

@nullkal
nullkal / decode.rb
Created February 4, 2015 20:49
BASE六十四卦
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'base64'
table = Hash[*"䷀䷪䷍䷡䷈䷄䷙䷊䷉䷹䷥䷵䷼䷻䷨䷒䷌䷰䷝䷶䷤䷾䷕䷣䷘䷐䷔䷲䷩䷂䷚䷗䷫䷛䷱䷟䷸䷯䷑䷭䷅䷮䷿䷧䷺䷜䷃䷆䷠䷞䷷䷽䷴䷦䷳䷎䷋䷬䷢䷏䷓䷇䷖䷁".split("").zip("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("")).flatten]
puts Base64.decode64((gets.split("").map {|c| table[c]}).join)