Cryptography Techs

1 篇文章 0 订阅

  1. SHA-1
    1. Secure Hash Algorithm -1
    2. Cryptographic hash function
    3. 160 bits (20 bytes, 40 digits in hex) -length hash value, known as message digest
    4. Application
      1. Verify integrity of file and message
        1. Beaware it does not encrypt the file or message!
      2. File identifier (Like SVN, git hub for patch id generation and control)
      3. Password verification (online gambling, etc)
        1. Server side only stores the passwd SHA-1, it verifies the Passwd by comparing the SHA-1 generated.

 

  1. PoW -proof of work (for bitcoin)

The sender is required to find a message whose hashvalue begins with a number of zero bits. The average work that sender needs toperform in order to find a valid message is exponential in the number of zerobits required in the hash value, while the recipient can verify the validity ofthe message by executing a single hash function. For instance, in Hashcash, asender is asked to generate a header whose 160 bit SHA-1 hash value has thefirst 20 bits as zeros. The sender will on average have to try 219 times to find a valid header.

  1. MD5
    1. Message Digest Algorithm 5
    2. 128 bits (16 Bytes, 32 digits in hex)
    3. MD5 is 30% faster than SHA-1
    4. Asymmetric

 

  1. DES
  2. RES

https://baike.baidu.com/item/%E6%95%B0%E6%8D%AE%E5%8A%A0%E5%AF%86/11048982?fr=aladdin

 

  1. Hash vs Encryption

https://stackoverflow.com/questions/4948322/fundamental-difference-between-hashing-and-encryption-algorithms

 

  1. Base64

Base64 is a group of similar binary-to-text encoding schemes that represent binary data inan ASCII string format by translating it into a radix-64representation

 

From <https://en.wikipedia.org/wiki/Base64>

 

8-bit-> 6-bit transcoding -> 8 bit ASCII again (64 characters only)

 

Base64schemes represent binary data in an ASCII string format (English alphabet,common punctuation chars, control chars) by translating it into a base-64representation.

 

Base64 encoding schemes are commonly usedwhen there is a need to encode binary data that needs be stored and transferredover media that are designed to deal with textual data. This is to ensure thatthe data remains intact without modification during transport

 

From <http://inchoo.net/magento/what-is-base64-encoding-and-how-can-we-benefit-from-it/>

 

Base64并不是为了压缩数据,而是为了将二进制文件字符化,以应对二进制文件传输过程中遇到错误处理的问题,例如txt会有分行,串口输出二进制需要特殊协议(串口的某些控制指令和二进制文件重合,串口输出典型的是字符和字符串,例如data=32,如果打印%d,则最后串口的输出需要是将3ASCII码和2ASCII码输出,而不是输出0x20).

典型的应用场景

  1. http内嵌小的icon图标,做base64转码,因为http是文本协议,通过解析文本来分段分属性,不做转码的话会有误识别;如果用二进制hex,也需要二进制字符串映射到真正的数字,html是解析text的。
  2. 串口输出图片;
  3. 电子邮件用base64转码翻译邮件内容;

 SinceSMTP [RFC 5321] only allowed 7-bit US-ASCII characters within themessages,  there was a need to represent these binary octet streams usingthe seven bit ASCII characters,  high bitwill be cleared to 0.

 

From <https://blogs.oracle.com/rammenon/base64-explained>

  1. Url

http://www.cnblogs.com/jerrysion/p/5522673.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值