Questions tagged [base36]

Base 36 is a positional numeral system using 36 as the radix. The choice of 36 is convenient in that the digits can be represented using the Arabic numerals 0-9 and the Latin letters A-Z.

52 questions
20
votes
5 answers

Convert a Long to base 36 in scala

How can I convert a Long to base36 ? Along with your answer can explain how you came to the answer? I've checked the scaladocs for Long for converting to a different base, and on converting a Long to a BigInt. I saw that BigInt does have toString(…
AKnox
  • 1,965
  • 3
  • 16
  • 19
16
votes
2 answers

Base 36 to Base 10 conversion using SQL only

A situation has arisen where I need to perform a base 36 to base 10 conversion, in the context of a SQL statement. There doesn't appear to be anything built into Oracle 9, or Oracle 10 to address this sort of thing. My Google-Fu, and AskTom…
EvilTeach
  • 26,577
  • 21
  • 79
  • 136
10
votes
2 answers

Base-36 representation of Digest

I would like to be able to take an arbitrary string, run it through a hashing function (like MD5), and then interpret the resulting digest in base-36. I know there already exists a Digest library in Ruby, but as far as I can tell I can't get at the…
Shaggy Frog
  • 27,118
  • 16
  • 85
  • 127
8
votes
1 answer

Encode String to Base36

Currently I am working at an algorithm to encode a normal string with each possible character to a Base36 string. I have tried the following but it doesn't work. public static String encode(String str) { return new BigInteger(str,…
Patrick Vogt
  • 738
  • 2
  • 13
  • 29
8
votes
3 answers

Convert an integer to base36

strtoi(x,base=36) will convert a base36-encoded string to an integer: strtoi("zzzz",base=36) [1] 1679615 Is there a function that inverts this operation, i.e., given a positive integer yields the base36 equivalent? Essentially, I'm looking for an…
Stephan Kolassa
  • 7,653
  • 2
  • 25
  • 45
8
votes
2 answers

Java: convert byte[] to base36 String

I'm a bit lost. For a project, I need to convert the output of a hash-function (SHA256) - which is a byte array - to a String using base 36. So In the end, I want to convert the (Hex-String representation of the) Hash, which…
Xenonite
  • 1,383
  • 3
  • 18
  • 34
7
votes
10 answers

How to generate unguessable "tiny url" based on an id?

I'm interested in creating tiny url like links. My idea was to simply store an incrementing identifier for every long url posted and then convert this id to it's base 36 variant, like the following in PHP: $tinyurl = base_convert($id, 10, 36) The…
Tom
  • 8,437
  • 26
  • 122
  • 217
7
votes
4 answers

Datatype to store 20 digit number

I have a number of 20 digit, which datatype will support to store this number? I have tried long, double but I 'm getting out of range. Number = 48565664968483514466 Then I have to convert this number to Base36 to generate the barcode.
DeepVeen
  • 179
  • 1
  • 4
  • 14
6
votes
1 answer

How to convert 2 Guids into string of max 50 characters length (2 way conversion)

have an interesting problem - I need to convert 2 (randomly) generated Guids into a string. Here are the constraints: string max 50 charactes length. only numbers and small letters can be used (0123456789abcdefghijklmnopqrstuvwxyz) the algorithm…
user1275154
  • 1,021
  • 1
  • 12
  • 21
6
votes
2 answers

Why JavaScript base-36 conversion appears to be ambiguous

I am currently writing a piece of JavaScript that uses base 36 encoding. I came across this problem: parseInt("welcomeback",36).toString(36) Appears to return "welcomebacg". I tested this in the Chrome developer's console and Node.js with the same…
nph
  • 172
  • 7
6
votes
1 answer

Converting string to base36 inconsistencies between languages.

I have noticed some inconsistencies between Python and JavaScript when converting a string to base36. Python Method: >>> print int('abcdefghijr', 36) Result: 37713647386641447 Javascript Method: