Skip to content

Instantly share code, notes, and snippets.

@nullkal
Created February 4, 2015 20:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nullkal/7084ac4a89e30e90888b to your computer and use it in GitHub Desktop.
Save nullkal/7084ac4a89e30e90888b to your computer and use it in GitHub Desktop.
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)
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'base64'
table = Hash[*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").zip("䷀䷪䷍䷡䷈䷄䷙䷊䷉䷹䷥䷵䷼䷻䷨䷒䷌䷰䷝䷶䷤䷾䷕䷣䷘䷐䷔䷲䷩䷂䷚䷗䷫䷛䷱䷟䷸䷯䷑䷭䷅䷮䷿䷧䷺䷜䷃䷆䷠䷞䷷䷽䷴䷦䷳䷎䷋䷬䷢䷏䷓䷇䷖䷁".split("")).flatten]
puts (Base64.encode64(gets).split("").map {|c| table[c]}).join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment