Skip to content

Commit

Permalink
provide checksum script to easily generate config checksum values
Browse files Browse the repository at this point in the history
  • Loading branch information
triffid committed Jan 2, 2013
1 parent 391d4ce commit b195040
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions checksum.pl
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/perl

use strict;

while (defined $ARGV[0]) {
my $s1 = 0;
my $s2 = 0;
my $str = shift @ARGV;

for (split //, $str) {
$s1 = ($s1 + (ord $_)) % 255;
$s2 = ($s2 + $s1) % 255;
};
printf "%s:\t%d\n", $str, ($s2<<8) + $s1;
}

0 comments on commit b195040

Please sign in to comment.