Created
January 5, 2011 05:09
-
-
Save poppen/765962 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Digest::MD5 qw( md5_hex ); | |
use feature qw( say ); | |
my $uri = 'http://api.flickr.com/services/rest/?'; | |
my $secret = $ARGV[0]; | |
my @argvs = split('&', $ARGV[1]); | |
my $params_ref; | |
for my $argv (@argvs) { | |
my($key, $val) = split('=', $argv); | |
$params_ref->{$key} = $val; | |
} | |
my $string = $secret; | |
for my $key (sort keys %{$params_ref}) { | |
$string .= $key; | |
$string .= $params_ref->{$key} | |
} | |
my $api_sig = md5_hex($string); | |
say $uri.$ARGV[1].'&api_sig='.$api_sig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment