Created
June 9, 2014 06:01
-
-
Save pascalduez/7dea20ff87ba9517489e to your computer and use it in GitHub Desktop.
Vigenère square or Vigenère table, aka tabula recta.
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
// ---- | |
// Sass (v3.3.8) | |
// Compass (v1.0.0.alpha.19) | |
// ---- | |
// Vigenère square or Vigenère table, aka tabula recta. | |
// https://en.wikipedia.org/wiki/Tabula_recta | |
@function shift($list, $value: 1, $dir: right) { | |
$result: (); | |
$length: length($list); | |
@for $i from 0 to $length { | |
$pos: if($dir == right, ($i + $value), ($i - $value)); | |
$pos: $pos % $length + 1; | |
$result: append($result, nth($list, $pos), list-separator($list)); | |
} | |
@return $result; | |
} | |
tabula { | |
$chars: a b c d e f g h i j k l m n o p q r s t u v w x y z; | |
_: $chars; | |
@for $i from 1 through length($chars) { | |
#{nth($chars, $i)}: shift($chars, $i - 1); | |
} | |
} |
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
tabula { | |
_: a b c d e f g h i j k l m n o p q r s t u v w x y z; | |
a: a b c d e f g h i j k l m n o p q r s t u v w x y z; | |
b: b c d e f g h i j k l m n o p q r s t u v w x y z a; | |
c: c d e f g h i j k l m n o p q r s t u v w x y z a b; | |
d: d e f g h i j k l m n o p q r s t u v w x y z a b c; | |
e: e f g h i j k l m n o p q r s t u v w x y z a b c d; | |
f: f g h i j k l m n o p q r s t u v w x y z a b c d e; | |
g: g h i j k l m n o p q r s t u v w x y z a b c d e f; | |
h: h i j k l m n o p q r s t u v w x y z a b c d e f g; | |
i: i j k l m n o p q r s t u v w x y z a b c d e f g h; | |
j: j k l m n o p q r s t u v w x y z a b c d e f g h i; | |
k: k l m n o p q r s t u v w x y z a b c d e f g h i j; | |
l: l m n o p q r s t u v w x y z a b c d e f g h i j k; | |
m: m n o p q r s t u v w x y z a b c d e f g h i j k l; | |
n: n o p q r s t u v w x y z a b c d e f g h i j k l m; | |
o: o p q r s t u v w x y z a b c d e f g h i j k l m n; | |
p: p q r s t u v w x y z a b c d e f g h i j k l m n o; | |
q: q r s t u v w x y z a b c d e f g h i j k l m n o p; | |
r: r s t u v w x y z a b c d e f g h i j k l m n o p q; | |
s: s t u v w x y z a b c d e f g h i j k l m n o p q r; | |
t: t u v w x y z a b c d e f g h i j k l m n o p q r s; | |
u: u v w x y z a b c d e f g h i j k l m n o p q r s t; | |
v: v w x y z a b c d e f g h i j k l m n o p q r s t u; | |
w: w x y z a b c d e f g h i j k l m n o p q r s t u v; | |
x: x y z a b c d e f g h i j k l m n o p q r s t u v w; | |
y: y z a b c d e f g h i j k l m n o p q r s t u v w x; | |
z: z a b c d e f g h i j k l m n o p q r s t u v w x y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment