fork download
  1. #!/usr/bin/perl
  2. # Author: gendou
  3. # Usage: elementcode.pl
  4. # Version: 1.0.0
  5. # Note: This cipher is based on the periodic table of elements.
  6.  
  7. my %ENCODE = (
  8. 'a' => 13, # Aluminum
  9. 'b' => 5, # Phosphorus
  10. 'c' => 6, # Carbon
  11. 'd' => 66, # Dysprosium
  12. 'e' => 63, # Europium
  13. 'f' => 9, # Fluorine
  14. 'g' => 31, # Gallium
  15. 'h' => 1, # Hydrogen
  16. 'i' => 53, # Iodine
  17. 'j' => 0, # [None]
  18. 'k' => 19, # Potassium
  19. 'l' => 3, # Lithium
  20. 'm' => 12, # Magnesium
  21. 'n' => 7, # Nitrogen
  22. 'o' => 8, # Oxygen
  23. 'p' => 15, # Phosphorus
  24. 'q' => 114, # Ununquadium
  25. 'r' => 37, # Rubidium
  26. 's' => 16, # Sulfur
  27. 't' => 22, # Titanium
  28. 'u' => 92, # Uranium
  29. 'v' => 23, # Vanadium
  30. 'w' => 74, # Tungsten
  31. 'x' => 54, # Xenon
  32. 'y' => 39, # Yttrium
  33. 'z' => 30, # Zinc
  34. '1' => 31, # Zinc
  35. '2' => 30, # Zinc
  36. '3' => 30 # Zinc
  37. );
  38. my $tk;
  39. my $counter=1;
  40. my $x;
  41. print "keys count:".keys (%ENCODE)."\n";
  42. foreach my $id ( keys (%ENCODE)) {
  43. if($counter % 5 == 0){
  44. print "\n".$x.$id;
  45. $x='';
  46. }
  47. else{
  48. $x.=$id.',';
  49. }
  50. $tk.=$id.',';
  51. $counter++;
  52. }
  53. #Process the remainder
  54. print "\nRemainder: ";
  55. print substr($x, 0, length($x)-1);
  56.  
  57. print "\n".substr($tk,0,length($tk)-1);
  58.  
  59. my $str="XX y?1";
  60. $str=~s/\?/$x/g;
  61. print "\n".$str;
Success #stdin #stdout 0.04s 25636KB
stdin
Standard input is empty
stdout
# 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;