Revision: 30609
Updated Code
at August 18, 2010 10:31 by ninjaparade
Updated Code
/* Function used to return flickr short url from a photo id. example of usage var shortFlickrURL:String = 'www.flic.kr/p/' + Base58Encoder.encode(Number('4725679319') ); /// returns www.flic.kr/p/8cAkPD /// short url for this full url http://www.flickr.com/photos/ninjaparade/4725679319/ */ package { /** * @author ninjaparade */ public class Base58Encoder { public static function encode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count : int = alphabet.length; var encode : String = ""; while(num >= base_count) { var div : int = num / base_count; var mod : int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return encode; } } }
Revision: 30608
Updated Code
at August 18, 2010 07:53 by ninjaparade
Updated Code
/* Function used to return flickr short url from a photo id. example of usage var shortFlickrURL:String = 'www.flic.kr/p/' + Base58Encoder.encode('4725679319'); /// returns www.flic.kr/p/8cAkPD /// short url for this full url http://www.flickr.com/photos/ninjaparade/4725679319/ */ package { /** * @author ninjaparade */ public class Base58Encoder { public static function encode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count : int = alphabet.length; var encode : String = ""; while(num >= base_count) { var div : int = num / base_count; var mod : int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return encode; } } }
Revision: 30607
Updated Code
at August 18, 2010 07:51 by ninjaparade
Updated Code
/* Function used to return flickr short url from a photo id. example of usage var shortFlickrURL:String = Base58Encoder.encode('4725679319'); /// returns www.flic.kr/p/8cAkPD /// short url for this full url http://www.flickr.com/photos/ninjaparade/4725679319/ */ package { /** * @author ninjaparade */ public class Base58Encoder { public static function encode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count : int = alphabet.length; var encode : String = ""; while(num >= base_count) { var div : int = num / base_count; var mod : int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return encode; } } }
Revision: 30606
Updated Code
at August 18, 2010 03:37 by ninjaparade
Updated Code
/* Function used to return flickr short url from a photo id. example of usage var shortFlickrURL:String = Base58Encoder.encode('4725679319'); /// returns www.flic.kr/p/8cAkPD /// short url for this full url http://www.flickr.com/photos/ninjaparade/4725679319/ */ package { /** * @author ninjaparade */ public class Base58Encoder { public static function encode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count : int = alphabet.length; var encode : String = ""; while(num >= base_count) { var div : int = num / base_count; var mod : int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return 'www.flic.kr/p/' + encode; } } }
Revision: 30605
Updated Code
at August 18, 2010 03:35 by ninjaparade
Updated Code
package { /** * @author ninjaparade */ public class Base58Encoder { public static function encode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count : int = alphabet.length; var encode : String = ""; while(num >= base_count) { var div : int = num / base_count; var mod : int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return 'www.flic.kr/p/' + encode; } } }
Revision: 30604
Updated Code
at August 18, 2010 03:30 by ninjaparade
Updated Code
package com.ninjaparade.util { /** * @author Ninjaparade */ public class Base58Encoder { public static function encode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count : int = alphabet.length; var encode : String = ""; while(num >= base_count) { var div : int = num / base_count; var mod : int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return 'www.flic.kr/p/' + encode; } } }
Revision: 30603
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 18, 2010 03:25 by ninjaparade
Initial Code
public static function base58_decode( num : Number ) : String { var alphabet : String = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' ; var base_count:int = alphabet.length; var encode:String = ""; while(num >= base_count) { var div : int = num / base_count; var mod: int = (num - base_count * Math.round(div) ); encode = alphabet.charAt(mod) + encode; num = Math.round(div); } if(num) { encode = alphabet.charAt(num) + encode; } return 'www.flic.kr/p/'+ encode; }
Initial URL
Initial Description
base 58 encoding in AS3 used to create a short url for flickr (flic.kr/p/) from a photo id. Function requires the flickr photo id to be passed in cast as a Number. Example below
Initial Title
Base 58 encode (used for flic.kr short urls)
Initial Tags
Initial Language
ActionScript 3