且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.Net C#中的Liferay加密算法实现

更新时间:2022-04-23 01:27:33

BigEndianCodec.putLong(_saltBytes, 0, SecureRandomUtil.nextLong())似乎是生成一个随机的8字节值并将其写入数组(按Big Endian顺序;但是它是随机的,因此不会没关系)".

BigEndianCodec.putLong(_saltBytes, 0, SecureRandomUtil.nextLong()) Seems to be "Generate a random 8-byte value and write it into an array (in Big Endian order; but it's random, so that doesn't matter)".

所以你想要

using (RandomNumberGenerator csprng = RandomNumberGenerator.Create())
{
    csprng.GetBytes(salt);
}

在分配salt并将其传递给Rfc2898DeriveBytes'ctor之间.

Between allocating salt and passing it to Rfc2898DeriveBytes' ctor.