Skip to content

Instantly share code, notes, and snippets.

@jreisinger
Last active June 10, 2017 12:52
Show Gist options
  • Save jreisinger/fff83e061f415d331e6d15726225e0f2 to your computer and use it in GitHub Desktop.
Save jreisinger/fff83e061f415d331e6d15726225e0f2 to your computer and use it in GitHub Desktop.
Exercise for Danik
#!/usr/bin/env perl
use strict;
use warnings;
use Digest::SHA qw(sha1_hex);
use List::Util qw(shuffle);
while (<DATA>) { # loop over lines of __DATA__ below
chomp; # remove newline
my ( $num, $last, $first ) = split /;/;
my $hashed_last = sha1_hex($last);
my $scrambled_num = join( "", shuffle( split //, $num ) );
print "$scrambled_num;$hashed_last;$first\n";
}
__DATA__
1234567890;Smith;John
1234567890;Bond;James
1234567890;Fox;Samantha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment