diff options
author | blafoo <github@blafoo.de> | 2012-02-21 22:13:24 +0100 |
---|---|---|
committer | blafoo <github@blafoo.de> | 2012-02-23 23:31:32 +0100 |
commit | 7ac4206e7c0308d2127845d7bf9214e73b845295 (patch) | |
tree | e76fd3a8c17c0a2cdd985ca7e393f8d072e24d05 /main/src/cgeo/geocaching/utils | |
parent | 6b58e073439bec94f0bbe59284e7d9bcab329f7f (diff) | |
download | cgeo-7ac4206e7c0308d2127845d7bf9214e73b845295.zip cgeo-7ac4206e7c0308d2127845d7bf9214e73b845295.tar.gz cgeo-7ac4206e7c0308d2127845d7bf9214e73b845295.tar.bz2 |
Unified methods for BASE 31
Diffstat (limited to 'main/src/cgeo/geocaching/utils')
-rw-r--r-- | main/src/cgeo/geocaching/utils/CryptUtils.java | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/main/src/cgeo/geocaching/utils/CryptUtils.java b/main/src/cgeo/geocaching/utils/CryptUtils.java index 08703d3..345af88 100644 --- a/main/src/cgeo/geocaching/utils/CryptUtils.java +++ b/main/src/cgeo/geocaching/utils/CryptUtils.java @@ -111,31 +111,4 @@ public final class CryptUtils { return buffer; } - public static String convertToGcBase31(final String gccode) { - final String alphabet = "0123456789ABCDEFGHJKMNPQRTVWXYZ"; - - if (null == gccode) { - return ""; - } - - char[] characters = gccode.toUpperCase().toCharArray(); - - if (characters.length <= 2) { - return ""; - } - - final int base = (characters.length <= 5 || (characters.length == 6 && alphabet.indexOf(characters[2]) < 16)) ? 16 : 31; - int result = 0; - - for (int i = 2; i < characters.length; i++) { - result *= base; - result += alphabet.indexOf(characters[i]); - } - - if (31 == base) { - result += Math.pow(16, 4) - 16 * Math.pow(31, 3); - } - - return Integer.toString(result); - } } |