go sample-base64
GoSample-base64
package mainimport ( "encoding/base64" "fmt")func base64Encode(src []byte) []byte { return []byte(base64.StdEncoding.EncodeToString(src))}func base64Decode(src []byte) ([]byte, error) { return base64.StdEncoding.DecodeString(string(src))}func main() { input := "hello world2" enbyte := base64Encode([]byte(input)) debyte, err := base64Decode(enbyte) if err != nil { fmt.Println(err.Error()) } if input != string(debyte) { fmt.Println("hello is not equal to enbyte") } fmt.Println(string(enbyte)) fmt.Println(string(debyte))}
输出
aGVsbG8gd29ybGQyhello world2
go sample-base64的更多相关文章
- jcaptcha sample 制作验证码
Skip to end of metadata Created by marc antoine garrigue, last modified by Jeremy Waters on Feb 23, ...
- Linux Rootkit Sample && Rootkit Defenser Analysis
目录 . 引言 . LRK5 Rootkit . knark Rootkit . Suckit(super user control kit) . adore-ng . WNPS . Sample R ...
- Python之数据加密与解密及相关操作(hashlib模块、hmac模块、random模块、base64模块、pycrypto模块)
本文内容 数据加密概述 Python中实现数据加密的模块简介 hashlib与hmac模块介绍 random与secrets模块介绍 base64模块介绍 pycrypto模块介绍 总结 参考文档 提 ...
- Python之数据加密与解密及相关操作(hashlib、hmac、random、base64、pycrypto)
本文内容 数据加密概述 Python中实现数据加密的模块简介 hashlib与hmac模块介绍 random与secrets模块介绍 base64模块介绍 pycrypto模块介绍 总结 参考文档 提 ...
- Sample Classification Code of CIFAR-10 in Torch
Sample Classification Code of CIFAR-10 in Torch from: http://torch.ch/blog/2015/07/30/cifar.html req ...
- Python3模块-random、hashlib和base64
random模块 random.random()用于生成一个浮点数x,范围为0 =< x < 1 import random >>>print(random.random ...
- hdu 5237 Base64(模拟)
Base64 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ...
- AutoIT: 学习对GUI Sample上所有的资源进行操作
$handle= WinGetHandle("Sample GUI") ;,"SRE Example 3 Result", $handle) $ctrl= Co ...
- HDU 5237 Base64
Base64 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Sub ...
- WUSTOJ 1324: Base64 Coding(Java)未解决,求题解
题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...
随机推荐
- 全部springxml文件约束 applicationContext.xml
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.sp ...
- centos PIL 安装
http://itekblog.com/centos-6-x-install-pil-python-imaging-library-tutorial/
- Objective C 快速入门学习三
1.数据类型 和C语言基本一样. 有一个特别数据类型id,可以储存任何类型的对象,它是实现多态和动态绑定的基础. Objective-C 2.程序结构 Objective-C和C的程序结构一模一样,具 ...
- C语言宏定义时#(井号)和##(双井号)的用法
C语言中如何使用宏C(和C++)中的宏(Macro)属于编译器预处理的范畴,属于编译期概念(而非运行期概念).下面对常遇到的宏的使用问题做了简单总结. 关于#和## 在C语言的宏中,#的功能是将其后面 ...
- 【IDEA】IDEA 如何设置编辑器字体大小
intellij idea 如何更改编辑器文本字体和大小 换上了intellij idea之后,第一件事就是想要改变下文字字体,因为在我这个27寸的2k分辨率的屏幕上,文字显然太小了. intel ...
- android一句话搞定图片加载
http://square.github.io/picasso/ Picasso.with(context).load("http://i.imgur.com/DvpvklR.png&quo ...
- linux的提示信息--/etc/motd和/etc/issue
/etc/motd 即 message of the day 每次用户登录时,这个文件的内容都会显示在用户的终端上.如果shell支持中文,还可以使用中文,这样看起来更加舒服. 成功登录后,自动输出. ...
- java web 学习 --第三天(Java三级考试)
第二天的学习内容这里:http://www.cnblogs.com/tobecrazy/p/3446646.html Jsp中的动作标签 <jsp:include> 实现动态包含,在一个文 ...
- ACM/ICPC 之 简单DP-记忆化搜索与递推(POJ1088-滑雪)
递推型DP 将每个滑雪点都看作起点,从最低点开始逐个由四周递推出到达此点的最长路径的长度,由该点记下. 理论上,也可以将每一点都看作终点,由最高点开始计数,有兴趣可以试试. //经典DP-由高向低海拔 ...
- 15.SpringMVC和Spring上下文关系(为什么SpringMVC可以调用到Spring)
springmvc上下文继承于spring, 也就是springmvc的上下文可访问spring上下文,在springmvc的上下文中可取得spring bean. spring上下文是spring启 ...