Skip to content

Instantly share code, notes, and snippets.

@poppen
Created January 5, 2011 05:09
Show Gist options
  • Save poppen/765962 to your computer and use it in GitHub Desktop.
Save poppen/765962 to your computer and use it in GitHub Desktop.
#!/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