如何在Ruby on Rails中计算32位CRC?

问题描述 投票:0回答:1

我想计算 Ruby on Rails 中“输入字段值”的 32 位 CRC 值。 需要示例代码,请帮助我。

ruby crc crc32
1个回答
47
投票

您可以使用 Ruby 的 Zlib 模块。

require 'zlib'
crc32 = Zlib::crc32('input field value')
© www.soinside.com 2019 - 2024. All rights reserved.