#!/usr/bin/perl
# Author: gendou
# Usage: elementcode.pl
# Version: 1.0.0
# Note: This cipher is based on the periodic table of elements.
my %ENCODE = (
'a' => 13, # Aluminum
'b' => 5, # Phosphorus
'c' => 6, # Carbon
'd' => 66, # Dysprosium
'e' => 63, # Europium
'f' => 9, # Fluorine
'g' => 31, # Gallium
'h' => 1, # Hydrogen
'i' => 53, # Iodine
'j' => 0, # [None]
'k' => 19, # Potassium
'l' => 3, # Lithium
'm' => 12, # Magnesium
'n' => 7, # Nitrogen
'o' => 8, # Oxygen
'p' => 15, # Phosphorus
'q' => 114, # Ununquadium
'r' => 37, # Rubidium
's' => 16, # Sulfur
't' => 22, # Titanium
'u' => 92, # Uranium
'v' => 23, # Vanadium
'w' => 74, # Tungsten
'x' => 54, # Xenon
'y' => 39, # Yttrium
'z' => 30, # Zinc
'1' => 31, # Zinc
'2' => 30, # Zinc
'3' => 30 # Zinc
);
my $tk;
my $counter=1;
my $x;
print "keys count:".keys (%ENCODE)."\n";
foreach my $id ( keys (%ENCODE)) {
if($counter % 5 == 0){
print "\n".$x.$id;
$x='';
}
else{
$x.=$id.',';
}
$tk.=$id.',';
$counter++;
}
#Process the remainder
print "\nRemainder: ";
print substr($x, 0, length
($x)-1);
print "\n".substr($tk,0,length
($tk)-1);
my $str="XX y?1";
$str=~s/\?/$x/g;
print "\n".$str;
IyEvdXNyL2Jpbi9wZXJsCiMgQXV0aG9yOiAgZ2VuZG91CiMgVXNhZ2U6ICAgZWxlbWVudGNvZGUucGwKIyBWZXJzaW9uOiAxLjAuMAojIE5vdGU6ICAgIFRoaXMgY2lwaGVyIGlzIGJhc2VkIG9uIHRoZSBwZXJpb2RpYyB0YWJsZSBvZiBlbGVtZW50cy4KCm15ICVFTkNPREUgPSAoCiAgICAnYScgPT4gMTMsICAjIEFsdW1pbnVtCgknYicgPT4gNSwgICAjIFBob3NwaG9ydXMKCSdjJyA9PiA2LCAgICMgQ2FyYm9uCgknZCcgPT4gNjYsICAjIER5c3Byb3N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0kaWQuJywnOwogICAgJGNvdW50ZXIrKzsKfQojUHJvY2VzcyB0aGUgcmVtYWluZGVyCnByaW50ICJcblJlbWFpbmRlcjogIjsKcHJpbnQgc3Vic3RyKCR4LCAwLCBsZW5ndGgoJHgpLTEpOwoKcHJpbnQgIlxuIi5zdWJzdHIoJHRrLDAsbGVuZ3RoKCR0ayktMSk7CgpteSAkc3RyPSJYWCB5PzEiOwokc3RyPX5zL1w/LyR4L2c7CnByaW50ICJcbiIuJHN0cjs=
# Author: gendou
# Usage: elementcode.pl
# Version: 1.0.0
# Note: This cipher is based on the periodic table of elements.
my %ENCODE = (
'a' => 13, # Aluminum
'b' => 5, # Phosphorus
'c' => 6, # Carbon
'd' => 66, # Dysprosium
'e' => 63, # Europium
'f' => 9, # Fluorine
'g' => 31, # Gallium
'h' => 1, # Hydrogen
'i' => 53, # Iodine
'j' => 0, # [None]
'k' => 19, # Potassium
'l' => 3, # Lithium
'm' => 12, # Magnesium
'n' => 7, # Nitrogen
'o' => 8, # Oxygen
'p' => 15, # Phosphorus
'q' => 114, # Ununquadium
'r' => 37, # Rubidium
's' => 16, # Sulfur
't' => 22, # Titanium
'u' => 92, # Uranium
'v' => 23, # Vanadium
'w' => 74, # Tungsten
'x' => 54, # Xenon
'y' => 39, # Yttrium
'z' => 30, # Zinc
'1' => 31, # Zinc
'2' => 30, # Zinc
'3' => 30 # Zinc
);
my $tk;
my $counter=1;
my $x;
print "keys count:".keys (%ENCODE)."\n";
foreach my $id ( keys (%ENCODE)) {
if($counter % 5 == 0){
print "\n".$x.$id;
$x='';
}
else{
$x.=$id.',';
}
$tk.=$id.',';
$counter++;
}
#Process the remainder
print "\nRemainder: ";
print substr($x, 0, length($x)-1);
print "\n".substr($tk,0,length($tk)-1);
my $str="XX y?1";
$str=~s/\?/$x/g;
print "\n".$str;