Skip to content
Browse files

provide checksum script to easily generate config checksum values

  • Loading branch information...
1 parent 391d4ce commit b195040c4acb969a765c5bc939a9b2bd3696867b @triffid triffid committed Dec 30, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 checksum.pl
View
15 checksum.pl
@@ -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.
Something went wrong with that request. Please try again.