生成 64 位签名的某种安全方法是什么?
我想要签名一个设备,并且我有 64 位可以在设备中存储我的签名。 该设备有一个 MAC 地址和一些其他详细信息(大约 30 个字节),我可以修改以创建我的签名。
如果可能的话,我希望该方法是单向的,这样我就可以在不知道如何创建有效签名的情况下验证签名是否有效。 大多数公私钥都有此功能,但它们生成的签名长度为 48 字节(我只有 8 字节)。
用 Python 实现是一个优点。
谢谢
编辑: 谢谢大家的建议。 听起来似乎没有安全的方法来做到这一点,只有一种对攻击者来说不太方便的方法。 我可能会使用加密哈希与秘密位混洗相结合。 这将与我的(非常弱的)“安全性”中的任何其他链接一样安全。
I would like to sign a device, and I have 64 bits to store my signature in the device. This device has a MAC address and some other details (about 30 bytes worth) I can mangle to create my signature.
If possible, I would like the method to be one-way, so that I can verify that the signature is valid without knowing how to create a valid signature. Most public-private keys have this feature but they generate signatures that are 48 bytes long (I only have 8 bytes).
Implementation in Python is a plus.
Thanks
EDIT:
Thanks for the advice everyone. It sounds like there is no secure way to do this, only a way that is moderately inconvenient to attackers. I'll probably use a cryptographic hash combined with secret bit-shuffling. This will be as secure as any other link in my (very weak) 'security'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
基本上,您需要的是 64 位 加密哈希函数,例如 Ripemd-64 或 elf -64。 然后,您使用加密方法对哈希值进行加密,并获得 64 位签名。 唯一的问题是,从非密码分析师的角度来看,64 位提供的签名比典型的超过 128 位哈希要弱得多。 尽管如此,它仍然适合您的应用。
Basically what you need is a 64-bit cryptographic hash funcion, such as Ripemd-64 or elf-64. Then you encrypt the hash with a cryptographic method and you got a 64 bit signature. The only problem is, from the point of view of a non-cryptoanalyst, that 64 bit offers a much weaker signature than typical over-128 bit hash. Nonetheless it could still be suitable for your application.
您可以只使用标准哈希函数 (MD5 SHA1),并且仅使用前 30 个字节或后 30 个字节。
哈希函数生成的字节数是相当任意的——这显然是空间和唯一性之间的权衡。 他们使用的签名长度没有什么特别的。
编辑 - 抱歉,我以为 MD5 返回 32 字节 - 它实际上返回 16 字节,但通常写为 32 十六进制数字。
You could just use a standard hashing function (MD5 SHA1) and only use the first or last 30 bytes.
The number of bytes a hashing function generates is fairly arbitrary - it's obviously a trade off between space and uniqueness. There is nothing special about the lenght of the signature they use.
Edit - sorry I was thinking that MD5 returned 32bytes- it actaulyl returns 16bytes but is ussually written as 32hex digits.
哈希函数和数字签名是非常不同的东西。
数字签名的大小取决于底层哈希函数和密钥长度。 因此理论上,您可以创建一个生成 64 位签名的 RSA 实现,但这将是一个极其弱的签名。
对于较小的密钥长度,您可能需要查看椭圆曲线加密技术。
编辑:是的,我是一名密码学家。
编辑2:但是,如果您只需要哈希函数,您可以按照 Fernando Miguélez 的建议查看 elf64 或 RIPEMD-64。
编辑3:计算一下,您需要使用ECC中的16位密钥来生成64位签名,这是非常弱的。 对于 ECC,任何低于 128 位的都可以被认为是弱的。 对于 RSA,这是 1024 位。
Hash functions and digital signatures are very different things.
The size of a digital signature depends on the underlying hash function and the key length. So in theory, you can create an RSA implementation that generates 64-bit signatures, but that'd be an extremely weak signature.
For smaller key lengths, you might want to look at elliptic curve cryptography.
EDIT: Yes, I'm a cryptographer.
EDIT 2: Yet if you only need a hash function, you can look at elf64 or RIPEMD-64 as Fernando Miguélez suggested.
EDIT 3: Doing the math, you'd need to use 16-bit keys in ECC to generate 64-bit signatures, which is very weak. For ECC, anything less than 128 bits can be considered weak. For RSA this is 1024 bits.