scala - What encoding or data type can be used to get alphanumeric string in elixir? -
my goal guess alphanumeric strings bitcoin mining match leading zeros. this, have increment encoded string , check whether string produces expected nonce.
for example in scala, can use base36 binary text encoding:- bigint(somealphanumstring, 36) , increment adding bigint(1, 36) our string.
what better way same in elixir?
integers in elixir arbitrary precision integers, there's no need special bigint data type. can convert base-36 string , integer using string.to_integer/2
, integer.to_string/2
this:
iex(1)> = string.to_integer("dogbert", 36) 29776764809 iex(2)> b = + 1 29776764810 iex(3)> integer.to_string(b, 36) "dogberu"
wiki
Comments
Post a Comment