zoukankan      html  css  js  c++  java
  • SHA1 VS RSA: what's the difference between them?

    SHA1 VS RSA: what's the difference between them?

    Fundamentally different.

    SHA1 is a hash algorithm, which is a one way function, turning an input of any size into a fixed-length output (160 bit in this case). A cryptographic hash function is one for which it should not be possible to find two inputs giving the same output except by brute force (for instance, with a 128-bit function you should need to try on average 2^64 message to find such a "collision"碰撞 due to something called the birthday paradox悖论 - Google it for more).

    In fact for SHA1 this is no longer the case - the algorithm is (in cryptographic terms at least) broken now, with a collision attack described by Xiaoyun Wang et al that beats a classic birthday attack. The SHA2 family is not broken, and a process is underway by NIST to agree on a SHA3 algorithm or family of algorithms.

    Edit - Google have now generated and published an actual SHA1 collision.

    RSA is an asymmetric encryption algorithm, encrypting an input into an output that can then be decrypted (contrast a hash algorithm which can't be reversed). It uses a different key for encryption (the public one) than for decryption (the private one). This can therefore be used to receive encrypted messages from others - you can publish your public key, but only you with the private key can then decrypt the messages that have been encrypted with it.

    If you reverse the keys for RSA, it can be used to generate a digital signature - by encrypting something with your private key, anyone can decrypt it with the public key and, if they are sure the public key belongs to you, then they have confidence that you were the one who encrypted the original. This is normally done in conjunction with a hash function - you hash your input, then encrypt that with your private key, giving a digital signature of a fixed length for your input message.

  • 相关阅读:
    Linux网络检测手段汇总
    Hadoop单机搭建
    Nginx之Location模块
    关于STM32驱动DS1302实时时钟的一点思考
    灵感手环第一步——0.96寸OLED显示实验
    把简单做到极致
    KEIL MDK 查看代码量、RAM使用情况--RO-data、RW-data、ZI-data
    关于SPI通信原理与程序实现
    【转载】keil5中加入STM32F10X_HD,USE_STDPERIPH_DRIVER的原因
    关于keil5使用注意事项(预定义、路径包含)
  • 原文地址:https://www.cnblogs.com/chucklu/p/14001295.html
Copyright © 2011-2022 走看看