base64

Vue图片压缩插件Irz(可直接获得图片的base64格式)

限于喜欢 提交于 2020-02-04 00:30:13
先下载(不指明下载环境时,默认下载到生产环境): npm install Irz import lrz from 'lrz' // 第1个参数是file对象类型 lrz(file1.file, { width :300, // 按宽度300px尺寸压缩上传 quality: 0.8 // 设置压缩质量 }).then(function(result) { // 成功时执行(即压缩成功后的图片信息) console.log(result); //{formData: FormData, fileLen: 14008, base64: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD…1mz0Pdo0y8St111H2grZZ3AySnJU4DPlP0ikl/YKi4n//2Q==", base64Len: 18703, origin: File, …} // fileLen: 14008 // console.log(result.base64); // 图片的base64格式(带头的) // console.log(this); // undefined base64img=result.base64.replace(/data:image\/.*;base64,/,''); //图片的base64格式(不带头的)传给后端的

Convert long integer(decimal) to base 36 string (strtol inverted function in C)

穿精又带淫゛_ 提交于 2020-02-03 09:17:05
问题 I can use the strtol function for turning a base36 based value (saved as a string) into a long int : long int val = strtol("ABCZX123", 0, 36); Is there a standard function that allows the inversion of this? That is, to convert a long int val variable into a base36 string, to obtain "ABCZX123" again? 回答1: There's no standard function for this. You'll need to write your own one. Usage example: https://godbolt.org/z/MhRcNA const char digits[] =

Convert ascii string to base64 without the “b” and quotation marks

筅森魡賤 提交于 2020-02-03 08:26:43
问题 I wanted to convert an ascii string (well just text to be precise) towards base64. So I know how to do that, I just use the following code: import base64 string = base64.b64encode(bytes("string", 'utf-8')) print (string) Which gives me b'c3RyaW5n' However the problem is, I'd like it to just print c3RyaW5n Is it possible to print the string without the "b" and the '' quotation marks? Thanks! 回答1: The b prefix denotes that it is a binary string . A binary string is not a string: it is a

Convert ascii string to base64 without the “b” and quotation marks

若如初见. 提交于 2020-02-03 08:24:14
问题 I wanted to convert an ascii string (well just text to be precise) towards base64. So I know how to do that, I just use the following code: import base64 string = base64.b64encode(bytes("string", 'utf-8')) print (string) Which gives me b'c3RyaW5n' However the problem is, I'd like it to just print c3RyaW5n Is it possible to print the string without the "b" and the '' quotation marks? Thanks! 回答1: The b prefix denotes that it is a binary string . A binary string is not a string: it is a

Java: Base64 Encode a String using a key

隐身守侯 提交于 2020-02-02 23:43:07
问题 Hi I have data and a key (both strings). The data needs to be encode using the key using Base64. Can some one give me a sample code. 回答1: Base64 is not for 'encoding with a key'. It is simply a encoding scheme: you can use Base64 to encrypt and decrypt strings without any extra's. It's just for very (very) basic security usages. 回答2: you can xor the data with your key and then base64 encode it. var key = "mykey"; var mydata = "some long text here"; var output = ''; for (var i = 0, len =

Decoding Base64 pdf giving broken file

有些话、适合烂在心里 提交于 2020-02-02 11:15:13
问题 Can someone please explain why decoding Base64 giving a broken pdf? I need to find the way how to decode Base64 and get pdf out. When i use this service https://emn178.github.io/online-tools/base64_decode_file.html I am able to pass Base64 and get file out without problem. But when i do same in node.js I am getting empty (broken) file consistently. I tried different packages like: js-base64, atob and none of them worked, getting same empty file as the result. Link to my code: https://repl.it/

Koa 中 Cookie 的使用

邮差的信 提交于 2020-02-02 09:47:34
Cookie 简介 cookie 是存储于访问者的计算机中的变量。可以让我们用同一个浏览器访问同一个域名的时候共享数据。 HTTP 是无状态协议。简单地说,当你浏览了一个页面,然后转到同一个网站的另一个页 面,服务器无法认识到这是同一个浏览器在访问同一个网站。每一次的访问,都是没有任何 关系的。 Koa Cookie 的使用 1 、 Koa 中设置 Cookie 的值 ctx.cookies.set(name, value, [options]) options 名称 options 值 maxAge 一个数字表示从 Date.now() 得到的毫秒数 expires cookie 过期的 Date path cookie 路径 , 默认是 '/' domain cookie 域名 secure 安全 cookie 默认 false ,设置成 true 表示 只有 https 可以访问 httpOnly 是否只是服务器可访问 cookie, 默认是 true overwrite 一个布尔值,表示是否覆盖以前设置的同名 的 cookie ( 默认是 false). 如果是 true, 在同 一个请求中设置相同名称的所有 Cookie (不 管路径或域)是否在设置此 Cookie 时从 Set-Cookie 标头中过滤掉。 a boolean indicating whether to

Is a space possible in a base64 encoding?

蓝咒 提交于 2020-02-01 10:31:25
问题 Is it possible for a string generated from a base64 encoding to have a space (' ') in it? 回答1: No. Next question? http://en.wikipedia.org/wiki/Base64#Variants_summary_table Actually, spaces and CRLFs are usually silently skipped during the decoding, as they might appear as a result of splitting long strings. 回答2: By reading the http://en.wikipedia.org/wiki/Base64 wiki it seems that in Base64 transfer encoding for MIME (RFC 2045) spaces are allowed and discarded. In all other variants they are

前端报错:Failed to execute 'setRequestHeader' on 'XMLHttpRequest': Value is not a valid ByteString.

家住魔仙堡 提交于 2020-02-01 06:20:51
报错详细: Unhandled Rejection (TypeError): Failed to execute 'setRequestHeader' on 'XMLHttpRequest': Value is not a valid ByteString. 报错原因: 是请求头中存在汉字 解决方案: 我们前段可以使用Base64进行编码 encodeURI() 这个函数,然后后端对这个Base64进行解码,具体函数如下: public String decode(String url) { String prevURL = ""; String decodeURL = url; while (!prevURL.equals(decodeURL)) { prevURL = decodeURL; decodeURL = URLDecoder.decode(decodeURL, StandardCharsets.UTF_8); } return decodeURL; } 来源: CSDN 作者: 骑鱼的猫咪 链接: https://blog.csdn.net/qq_39820860/article/details/103807786

BUU misc(GXYCTF2019)

青春壹個敷衍的年華 提交于 2020-01-31 21:24:19
gakki 下载压缩包之后是一张gakki的图片, foremost一下,得到一个压缩包,包里有flag.txt,但是需要密码才能打开。尝试数字爆破,得到密码8864,打开之后得到一串奇奇怪怪的字符, 看了大佬的wp,对于这种无规律的字符集要尝试字频统计,附上字频统计exp: alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+- ={}[]" f = open ( "flag.txt" , "r" ) data = f . read ( ) result = { d : 0 for d in alphabet } def sort_by_value ( d ) : items = d . items ( ) backitems = [ [ v [ 1 ] , v [ 0 ] ] for v in items ] backitems . sort ( reverse = True ) return [ backitems [ i ] [ 1 ] for i in range ( 0 , len ( backitems ) ) ] for d in data : for alpha in alphabet : if d == alpha : result [