We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我有以下幾行 Java 程式碼需要移植到 Ruby 來,但是找不到相對應的函式可以用,不知道是否有人可以指導如何轉換成 Ruby 程式碼,謝謝。
byte[] seed = Base64.getDecoder().decode((byte[])"aGVsbG93b3JsZA==".getBytes("UTF-8")); byte[] key = new byte[16]; SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG"); rnd.setSeed(seed); rnd.nextBytes(key);
The text was updated successfully, but these errors were encountered:
Hello,
require 'digest/sha1' p Digest::SHA1.hexdigest('testtest')
以上是我曾經用過的方式,你再試試看!!
Sorry, something went wrong.
@GeorgioWan 謝謝回覆
目前比較大的困擾是在 Java 程式中使用的 setSeed 方法,Java 內 setSeed 的參數可以是 byte[] 或 long 的格式,而我現在只有看到 Ruby 的 Random 也可以設定 PRNG,但只支援 Integer
setSeed
byte[]
long
Random
Integer
No branches or pull requests
我有以下幾行 Java 程式碼需要移植到 Ruby 來,但是找不到相對應的函式可以用,不知道是否有人可以指導如何轉換成 Ruby 程式碼,謝謝。
The text was updated successfully, but these errors were encountered: