Blog

Thinking will not overcome fear but action will.

TLS协议(三)

透明加密 用户无感知的加密解密过程,文件打开的时候自动解密,离开使用环境无法打开。文件在磁盘上是密文,在内存里是明文。

TLS协议(二)

密钥交换算法 Diffie-Hellman密钥交换 $A=g^a\,\,(mod\,\,\,p)$ $B=g^b\,\,(mod\,\,\,p)$ $SA = B^a\,\,\,mod\,\,\,p=[g^b\,\,(mod\,\,\,p)]^a\,\,\,mod\,\,\,p$ $SB=A^b\,\,\,mod\,\,\,p=[g^a\,\,(mod\,\,\,p)]^b\,...

TLS协议(一)

本文数据包来源 对eth0网口抓包,访问github.com,这是TLS通信过程。 TLS client hello 客户端版本:客户端希望支持的协议版本 客户端随机数:客户端生成,32字节,前4个字节表示epoch格式的当前日期时间,其余28个字节由加密强随机数生成器生成 密码套件:客户端支持的密码套件 server hello 服务端版本:...

leetcode40.组合总和II

//给定一个数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 // // candidates 中的每个数字在每个组合中只能使用一次。 // // 注意:解集不能包含重复的组合。 // // // // 示例 1: // // //输入: candidates = [10,1,2,7,6,1,5],...

leetcode39.组合总和

Question //给定一个无重复元素的正整数数组 candidates 和一个正整数 target ,找出 candidates 中所有可以使数字和为目标数 target 的 //唯一组合。 // // candidates 中的数字可以无限制重复被选取。如果至少一个所选数字数量不同,则两种组合是唯一的。 // // 对于给定的输入,保证和为 target 的唯一组合数少于 150...

leetcode50.Pow(x,n)

Question //实现 pow(x, n) ,即计算 x 的 n 次幂函数(即,xn)。 // // // // 示例 1: // // //输入:x = 2.00000, n = 10 //输出:1024.00000 // // // 示例 2: // // //输入:x = 2.10000, n = 3 //输出:9.26100 // // // 示例 3: //...

go-struct

Struct type person struct { age int name string } func (p person) String_name() string{ return "the person name is " + p.name } func (p person) Int_age() int{ return p.age } func (p pers...

go-interface

Interface package main import ( "fmt" ) type hello_inter interface { hello() } type animal interface { printInfo() } type cat string type dog string type bird string type edog string type ...

go-goroutine

goroutine go语言中并发指的是让某个函数独立于其他函数运行的能力,一个goroutine就是一个独立的工作单元,Go的runtime(运行时)会在逻辑处理器上调度这些goroutine来运行,一个逻辑处理器绑定一个操作系统线程,所以说goroutine不是线程,它是一个协程,也是这个原因,它是由Go语言运行时本身的算法实现的。 概念 说...

go-chan

chan 定义: ch := make(chan int) ch<-2//发送数值2给这个通道 x:=<-ch //从通道里读取值,并把读取的值赋值给x变量 <-ch //从通道里读取值,然后忽略 close(ch) //内置close,关闭 ch := make(chan int,0) 第二个参数是通道的大小,0则是无缓冲通道。有缓冲通道,其实是一个队列。 对于...