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的更多相关文章

  1. jcaptcha sample 制作验证码

    Skip to end of metadata Created by marc antoine garrigue, last modified by Jeremy Waters on Feb 23, ...

  2. Linux Rootkit Sample && Rootkit Defenser Analysis

    目录 . 引言 . LRK5 Rootkit . knark Rootkit . Suckit(super user control kit) . adore-ng . WNPS . Sample R ...

  3. Python之数据加密与解密及相关操作(hashlib模块、hmac模块、random模块、base64模块、pycrypto模块)

    本文内容 数据加密概述 Python中实现数据加密的模块简介 hashlib与hmac模块介绍 random与secrets模块介绍 base64模块介绍 pycrypto模块介绍 总结 参考文档 提 ...

  4. Python之数据加密与解密及相关操作(hashlib、hmac、random、base64、pycrypto)

    本文内容 数据加密概述 Python中实现数据加密的模块简介 hashlib与hmac模块介绍 random与secrets模块介绍 base64模块介绍 pycrypto模块介绍 总结 参考文档 提 ...

  5. 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 ...

  6. Python3模块-random、hashlib和base64

    random模块 random.random()用于生成一个浮点数x,范围为0 =< x < 1 import random >>>print(random.random ...

  7. hdu 5237 Base64(模拟)

    Base64 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Subm ...

  8. AutoIT: 学习对GUI Sample上所有的资源进行操作

    $handle= WinGetHandle("Sample GUI") ;,"SRE Example 3 Result", $handle) $ctrl= Co ...

  9. HDU 5237 Base64

    Base64 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Sub ...

  10. WUSTOJ 1324: Base64 Coding(Java)未解决,求题解

    题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...

随机推荐

  1. C# 基于json通讯中的中文的处理

    如果通讯中产生了\\u4e00-\\u9fa5范围的中文的unicode代码,而不是\u4e00-\u9fa5范围的,那么c#的处理就比较麻烦了. 破解方法: 机制 它会把\\u4e00拆成部分来识别 ...

  2. jquery数组内多维对象

    jquery数组内多维对象 var postData=[],obj,list; obj = !!obj ? obj : $('#dist_meici_checkinfo_form'); obj.fin ...

  3. string转DateTime(时间格式转换)

    1.不知道为什么时间在数据库用varchar(8)来保存,例如"19900505",但是这样的保存格式在处理时间的时候是非常不方便的. 但是转换不能用Convert.ToDateT ...

  4. c#.net Excel中的数据导入到SQL数据库中

    /// <summary>        /// 从Excel 导入学生        /// </summary>        /// <param name=&qu ...

  5. Linux下查看机器公网IP

    http://jimingsong.iteye.com/blog/1188905 curl http://ifconfig.me

  6. C Primer Plus_第四章_字符串和格式化输入输出_编程练习

    Practice 1.输入名字和姓氏,以"名字,姓氏"的格式输出打印. #include int main(void) { char name[20]; char family[2 ...

  7. inline函数的用法

    在c/c++中,为了解决一些频繁调用的小函数大量消耗栈空间或是叫栈内存的问题,特别的引入了inline修饰符,表示为内联函数.栈空间就是指放置程式的局部数据也就是函数内数据的内存空间,在系统下,栈空间 ...

  8. Oracle 修改现有列的数据类型

    如果表中有数据,Oracle是不能修改其数据类型的.但可以通过新建一个临时列,将要修改列的数据复制到临时列中,删除原列再修改临时列的名字.这样说好像有点拗口,分步解说一下. 表AC_REG中有列:is ...

  9. 【leetcode】Merge Two Sorted Lists(easy)

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...

  10. #ifndef -摘自百度百科

    #ifndef 标识1 //判断"标识1"是否定义,如果被定义则返回假,如果没有被定义则返回真. /**********************************/ 语句1 ...