对称密钥和非对称密钥
对称密钥顾名思义就是两个end users使用同一个key,Secret Key来进行加密解密。最大的问题就是如何安全的传输SK给另一方。
非对称密钥就是说每个人都拥有一个public key和一个private key。public key来进行加密,private key用于解密。public key一般存放于一个受信任的第三方机构或者自己发放,private key仅私人拥有不对外开放。这种做法拥有绝对安全,但是效率比较慢,解密花费的时间成本较高。
所以通常来说,我们使用非对称加密传输Secret Key,然后用对称加密来完成传输,这样可以保证安全又保证效率。
他们的Differences:
⚫ Symmetric ciphers use only one cryptographic key whereas asymmetric ciphers use two.
⚫ Symmetric ciphers normally use one algorithm which runs forward for encryption and backwards for decryption. Asymmetric ciphers normally have two different algorithms, one for encryption and another for decryption.
⚫ Symmetric ciphers are normally much faster than asymmetric ciphers.
⚫ Symmetric ciphers are prone to the key sharing problem, asymmetric ciphers were introduced to resolve the key sharing problem.
⚫ Symmetric ciphers are secure with smaller key sizes as the keys are always kept secret. Asymmetric ciphers need much larger key sizes as the public key is always available and can be reverse engineered to obtain the private key.
解密加密算法常见的五个部件术语:
Plaintext – The original intelligible message or data.
Encryption Algorithm – An algorithm which performs various substitutions and transformations on the plaintext.
Secret Key – Is an input required for the encryption algorithm and is independent of the plaintext and the algorithm
Ciphertext – This is the scrambled message of the plaintext produced by the encryption algorithm as an output.
Decryption Algorithm – An algorithm which allows for the receiver to obtain the plaintext back from the ciphertext. For a symmetric cipher, the decryption algorithm is normally the encryption algorithm run in reverse.
计算modulo inverse
什么是modulo inverse
就是对于模数n来说,会有两个数a, b,a*b mod n = 1。这时候我们称a是b的modulo inverse(反之亦可),写作b = a-1。
那么通常的计算方式采用Extended Euclid’s algorithm的GCD(最大公约数)来做,也就是保留系数,不多逼逼上例子:
a. 3−1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)