我想使用boost :: crc_32_type在我的c ++代码中生成字符串的crc代码,然后使用(java.util.zip.CRC32)在java中重新生成它,但结果不一样.有人可以帮忙吗?
所以.结果是平等的.
import java.util.*;
import java.lang.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
String s = new String("123456789");
java.util.zip.CRC32 crc32 = new java.util.zip.CRC32();
crc32.update(s.getBytes());
System.out.println(crc32.getValue());
}
}
Run Code Online (Sandbox Code Playgroud)
3421780262
#include <boost/crc.hpp>
#include <string>
#include <iostream>
#include <algorithm>
int main()
{
const std::string str = "123456789";
boost::crc_32_type crc32;
crc32 = std::for_each(str.begin(), str.end(), crc32);
std::cout << crc32() << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
3421780262
http://liveworkspace.org/code/0a5c4f1eaa920bd0161f7d37fa809aa3
| 归档时间: |
|
| 查看次数: |
1569 次 |
| 最近记录: |