Where is the SecureRandom in Crystal?

I saw it exist in 0.19.2, but could not find it in 1.4.1

Basically, what i want is generate a readable digest hash, like this in rails:

irb(main):003:0> SecureRandom.base58(32)
=> "GKH923LgU3Jcc1QPdUPZnyNkVwVF18Cr"

Thank you.


Updated:

I find a shard here

module Base58
  extend self

  VERSION = "0.1.0"

  ALPHABET = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ".chars

  def random(chars : Int32)
    String.build(chars) do |sb|
      chars.times { sb << ALPHABET.sample }
    end
  end
end

Anyway, i still want to know if there exists a standard library for this.

https://crystal-lang.org/api/1.4.1/Random/Secure.html

2 Likes