in reply to Shorter ID Codes
So the procedure is to convert base 10 number to base 36, and then assign number and letters. Let's take 0-9 to be just 0-9 and 10-35 to be A-Z. Then the encoding step would be
use Math::BaseCalc; $calc36 = new Math::BaseCalc(digits=>[0..9,'A'..'Z']; $calc10 = new Math::BaseCalc(digits=>[0..9]); $in_base_36 = $calc36->to_base($calc10->from_base('4345317546') ); $in_base_10 = $calc10->to_base( $calc36->from_base('DA5BG') );
-Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Shorter ID Codes
by diotalevi (Canon) on Oct 28, 2004 at 18:17 UTC |