精华内容
下载资源
问答
  • Remove url_safe_base64 gem

    2020-12-08 20:14:21
    ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17] Calculating ------------------------------------- ruby_stdlib_decode 667.957k (± 2.7%) i/s - 3.380M in 5.064439s url_safe_base64_decode ...
  • iOS Base64URL编码:java中,在进行base64编码时会看到相似如下代码:String result = Base64.encodeToString(bytedata, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING);其中参数的含义是:URL_SAFE:...

    一. iOS Base64URL编码:

    java中,在进行base64编码时会看到相似如下代码:String result = Base64.encodeToString(bytedata, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING);

    其中参数的含义是:URL_SAFE:安全的URL编码,base64转码过程中会生成“+”,“/”,“=”这些会被URL进行转码的特殊字符,导致前后端数据不同,所以需要将这些字符替代为URL不会进行转码的字符,保证数据同步; "-" -> "+" "_" -> "/" NO_WRAP:不换行 NO_PADDING:"="号补齐去除,base64会对字符进行串长度余4的"="的补位,需去除"="。

    这些功可以都是android.utils.Base64中自带的

    在iOS中没有,所以我们只可以自己动手了~

    Swift代码://MARK: Data转Base64URL加密internal class func convertByte(bytedata:Data?) -> String { guard let bytedata = bytedata else { return "" } // data数据进行base64加密 guard let result = bytedata.base64EncodedString() else { return "" } // %替换为_ let result4 = result.replacingOccurrences(of: "%", with: "_") // =替换为空 let result1 = result4.replacingOccurrences(of: "=", with: "") // +替换为— let result2 = result1.replacingOccurrences(of: "+", with: "-") // /替换为_ let result3 = result2.replacingOccurrences(of: "/", with: "_") return result3}//MARK: 后端反回的base64字符串转为datainternal class func convertBase64URL(base64:String?) -> Data? { guard let base64 = base64 else { return nil } // -替换为+ let base64Str = base64.replacingOccurrences(of: "-", with: "+") // _替换为/ let base64Str2 = base64Str.replacingOccurrences(of: "_", with: "/") var base64Str3 = "" // =号补全 let mod4 = base64Str.count % 4 if mod4 > 0 { let appStr = ("====" as NSString).substring(to: (4 - mod4)) base64Str3 = base64Str2 + appStr } // base64Str转data并进行Base64Decoding return Data(base64Encoded: base64Str3, options: Data.Base64DecodingOptions.init(rawValue: 0))}

    OC://MARK: 将saveBase64编码中的"-","_"字符串转换成"+","/",字符串长度余4倍的位补"="+(NSData*)safeUrlBase64Decode:(NSString*)safeUrlbase64Str{ // '-' -> '+' // '_' -> '/' // 不足4倍长度,补'=' NSMutableString * base64Str = [[NSMutableString alloc]initWithString:safeUrlbase64Str]; base64Str = (NSMutableString * )[base64Str stringByReplacingOccurrencesOfString:@"-" withString:@"+"]; base64Str = (NSMutableString * )[base64Str stringByReplacingOccurrencesOfString:@"_" withString:@"/"]; NSInteger mod4 = base64Str.length % 4; if(mod4 > 0) [base64Str appendString:[@"====" substringToIndex:(4-mod4)]]; NSLog(@"Base64原文:%@", base64Str); return [GTMBase64 decodeData:[base64Str dataUsingEncoding:NSUTF8StringEncoding]]; }//MARK: 由于Base64编码中包含有+,/,=这些不安全的URL字符串,所以要进行换字符+(NSString*)safeUrlBase64Encode:(NSData*)data{ // '+' -> '-' // '/' -> '_' // '=' -> '' NSString * base64Str = [GTMBase64 stringByEncodingData:data]; NSMutableString * safeBase64Str = [[NSMutableString alloc]initWithString:base64Str]; safeBase64Str = (NSMutableString * )[safeBase64Str stringByReplacingOccurrencesOfString:@"+" withString:@"-"]; safeBase64Str = (NSMutableString * )[safeBase64Str stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; safeBase64Str = (NSMutableString * )[safeBase64Str stringByReplacingOccurrencesOfString:@"=" withString:@""]; NSLog(@"safeBase64编码:%@", safeBase64Str); return safeBase64Str;}

    展开全文
  • PHP base64url_encode

    2020-06-29 18:19:11
    base64编码之后,如果直接作为get参数进行...functionbase64url_encode($data) { returnrtrim(strtr(base64_encode($data),'+/','-_'),'='); } functionbase64url_decode($data) { returnbase64_decode(str_pad(s...

    base64编码之后,如果直接作为get参数进行传输,由于url转义的问题,base64之后的字符会被转义,可以使用下面的函数,啥也不说了,上代码:

    <?php 
    function base64url_encode($data) { 
      return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); 


    function base64url_decode($data) { 
      return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); 

    ?>

    其实还可以使用urlencode就行处理

    展开全文
  • <p>test_url_seed manages to run url_seed_ssl_keepalive correctly and then once it gets to url_seed_ssl, which does not use keepalive, it silently returns. I found that it quits at send_header("...
  • <div><p>https://developers.facebook.com/docs/authentication/signed_request/ states that the JSON part of the signed request is base64url encoded. <p>Without this fix, decoding signed requests ...
  • url_redirector.lua:230: select user agent Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) #8401(normal) <d313ef>; url_redirector; url_redirector.lua:196: found redirect from ...
  • iOS SHA1 和 Base64 url_safe 加密网上查找的资料SHA1加密后大部分获取的是字符串,如果还要进行下一步操作时,一定要慎用字符串,我最近在做SHA1 和 Base64 url_safe 加密,用SHA1加密后的获取字符串进行Base64编码...

    iOS SHA1 和 Base64 url_safe 加密

    网上查找的资料SHA1加密后大部分获取的是字符串,如果还要进行下一步操作时,一定要慎用字符串,我最近在做SHA1 和 Base64 url_safe 加密,用SHA1加密后的获取字符串进行Base64编码,但是得到的数值对比安卓和后台接口得到的数值都不一样,安卓和后台SHA1可以直接获取二进制流,然后进行Base64编码,iOS  SHA1没法直接获取data数据,如果转换成字符串在进行Base64编码,得到的数据就不统一,这是一个很大的坑,一定要看好  Demo 地址

    #import "XWSSHA1Tool.h"

    #import <CommonCrypto/CommonCrypto.h>

    #import "GTMBase64.h"


    @implementation XWSSHA1Tool


    //普通字符串加密,返回值字符串

    + (NSString *)xwsSHA1:(NSString *)input

    {

        const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];

        NSData *data = [NSData dataWithBytes:cstr length:input.length];

        

        uint8_t digest[CC_SHA1_DIGEST_LENGTH];

        

        CC_SHA1(data.bytes, (unsigned int)data.length, digest);

        

        NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];

        

        for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)

            [output appendFormat:@"%02x", digest[i]];

        

        NSString *shaStr = [NSString stringWithFormat:@"%@",output];

        NSData *dataBase = [shaStr dataUsingEncoding:NSUTF8StringEncoding];

        NSString *base64String = [dataBase base64EncodedStringWithOptions:0];

        

        return base64String;

    }


    //带有汉子类型加密,返回值字符串

    + (NSString *)xwsHanziSHA1:(NSString *)input

    {

        NSData *data = [input dataUsingEncoding:NSUTF8StringEncoding];

        

        uint8_t digest[CC_SHA1_DIGEST_LENGTH];

        

        CC_SHA1(data.bytes, (unsigned int)data.length, digest);

        

        NSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];

        

        for(int i=0; i<CC_SHA1_DIGEST_LENGTH; i++) {

            [output appendFormat:@"%02x", digest[i]];

        }

        

        return output;

    }


    //普通字符串加密,返回值字NSData

    + (NSData *)getDataSHA1:(NSString *)input

    {

        const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];

        NSData *data = [NSData dataWithBytes:cstr length:input.length];

        

        uint8_t digest[CC_SHA1_DIGEST_LENGTH];

        

        CC_SHA1(data.bytes, (unsigned int)data.length, digest);

        

        NSData * base64 = [[NSData alloc]initWithBytes:digest length:CC_SHA1_DIGEST_LENGTH];

        

        return base64;

    }


    //先SHA1后进行Base64(url_safe)

    + (NSString *)getSHA1WithBase64:(NSString *)input

    {

        const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];

        NSData *data = [NSData dataWithBytes:cstr length:input.length];

        

        uint8_t digest[CC_SHA1_DIGEST_LENGTH];

        

        CC_SHA1(data.bytes, (unsigned int)data.length, digest);

        

        //SHA1直接转data

        NSData * base64 = [[NSData alloc]initWithBytes:digest length:CC_SHA1_DIGEST_LENGTH];

        

        //SHA1进行Base64编码

        //Base64编码中包含有"+,/,="不安全的URL字符串,我们要对这些字符进行转换

        NSString * base64Str = [GTMBase64 encodeBase64Data:base64];

        NSMutableString * safeBase64Str = [[NSMutableString alloc]initWithString:base64Str];

        safeBase64Str = (NSMutableString * )[safeBase64Str stringByReplacingOccurrencesOfString:@"+" withString:@"-"];

        safeBase64Str = (NSMutableString * )[safeBase64Str stringByReplacingOccurrencesOfString:@"/" withString:@"_"];

        safeBase64Str = (NSMutableString * )[safeBase64Str stringByReplacingOccurrencesOfString:@"=" withString:@""];

        NSLog(@"safeBase64编码:%@", safeBase64Str);

        return safeBase64Str;

    }


    @end



    展开全文
  • ImportError: /software/anaconda3/lib/python3.8/site-packages/mamba/mamba_api.cpython-38-x86_64-linux-gnu.so: undefined symbol: curl_url_cleanup</p><p>该提问来源于开源项目:mamba-org/mamba</p></...
  • Missing wsgi.url_scheme

    2020-12-09 16:08:17
    <div><p>Flask seems to require <code>wsgi.url_scheme</code> in the WSGI environ dict. <pre><code> [ERROR] KeyError: 'wsgi.url_scheme' Traceback (most recent call last): File "/var/task/__...
  • 目录from urllib.parse import urlparse, quote, unquote, urlencode1、解析url的组成成分:urlparse(url)2、url的base64编解码:quote(url)、unquote(url)3、字典变成一个字符串=&连接,并且被base64编码:...

    目录

    from urllib.parse import urlparse, quote, unquote, urlencode

    1、解析url的组成成分:urlparse(url)

    2、url的base64编解码:quote(url)、unquote(url)

    3、字典变成一个字符串=&连接,并且被base64编码:urlencode(字典)

    from urllib.parse import urlparse, quote, unquote, urlencode

    print("======== 1 解析url的组成==========")

    url='http://www.freebuf.com/articles/437.html'

    url_parse = urlparse(url)

    print(url_parse)

    print(url_parse.netloc)

    print("======== 2 对字符串进行base64编码和反编码==========")

    url = 'http://www.example.com/api.php?text=中文在这里'

    # 不带附加参数

    print('不带附加参数:\n%s' % quote(url))

    # 附带不转换字符参数

    print('附加不转换字符参数:\n%s' % quote(url, safe='/:?='))

    print(unquote("text%3D%E4%B8%AD%E6%96%87%E5%9C%A8%E8%BF%99%E9%87%8C"))

    print("======== 3 对字典转换为=&连接的字符串,并且base64编码==========")

    params = {

    "uid": "123",

    "type": "get",

    "nickname": "abc划水的鱼儿",

    }

    print(params)

    data_str_base64 = urlencode(params) # 字典转为字符串,并且base64编码

    print(type(data_str_base64))

    print(data_str_base64)

    data_str_unbase64 = unquote(data_str_base64) # 字符串中base64被反解码

    print(data_str_unbase64)

    输出结果:

    到此看懂了,后面就可以不用看了。

    1、解析url的组成成分:urlparse(url)

    提取域名domain

    from urllib.parse import urlparse

    url = 'http://www.freebuf.com/articles/437.html'

    url_parse = urlparse(url)

    print(url_parse)

    print(url_parse.netloc)

    print(url_parse.hostname)

    输出:

    ParseResult(scheme='http', netloc='www.freebuf.com', path='/articles/437.html', params='', query='', fragment='')

    www.freebuf.com

    www.freebuf.com

    2、url的base64编解码:quote(url)、unquote(url)

    url的base64编码 、解码

    from urllib.parse import quote

    url = 'http://www.example.com/api.php?text=中文在这里'

    # 不带附加参数

    print('\n不带附加参数:\n%s' % quote(url))

    # 附带不转换字符参数

    print('\n附加不转换字符参数:\n%s' % quote(url, safe='/:?='))

    输出结果:

    base64解码

    print(unquote("text%3D%E4%B8%AD%E6%96%87%E5%9C%A8%E8%BF%99%E9%87%8C"))

    (一)字符串转义为base64编码和解码(和上文重复,不用看)

    import urllib.parse

    url_han = 'https://www.baidu.com/s?wd=北京'

    print(urllib.parse.quote(url_han)) # base64编码

    # https%3A//www.baidu.com/s%3Fwd%3D%E5%8C%97%E4%BA%AC

    url_base64 = 'https://www.baidu.com/s?wd=%E6%B7%B1%E5%9C%B3'

    print(urllib.parse.unquote(url_base64)) # base64反编码

    # https://www.baidu.com/s?wd=深圳

    3、字典变成一个字符串=&连接,并且被base64编码

    (二)字典转化为&连接的字符串

    说明:字典转字符串后,发生了2件事

    1、冒号变成等号;逗号变成&

    2、汉字和特殊字符被base64编码

    案例:

    源代码:

    import urllib.parse

    params = {

    "uid": "123",

    "type": "get",

    "nickname": "abc划水的鱼儿",

    }

    print(params)

    data_str_base64 = urllib.parse.urlencode(params) # 字典转为字符串,并且base64编码

    print(type(data_str_base64))

    print(data_str_base64)

    data_str_unbase64 = urllib.parse.unquote(data_str_base64) # 字符串中base64被反解码

    print(data_str_unbase64)

    输出结果:

    {'uid': '123', 'type': 'get', 'nickname': 'abc划水的鱼儿'}

    uid=123&type=get&nickname=abc%E5%88%92%E6%B0%B4%E7%9A%84%E9%B1%BC%E5%84%BF

    uid=123&type=get&nickname=abc划水的鱼儿

    展开全文
  • 遇到这种情况找不到网页net::ERR_UNKNOWN_URL_SCHEME //加上它就OK了 webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0"); ...
  • In [55]: from cachecontrol.caches.file_cache import url_to_file_path In [56]: from contextlib import contextmanager In [57]: from tempfile import gettempdir In [58]: file_cache = FileCache...
  • 原文地址:[url]http://bbs.linuxpk.com/viewthread.php?tid=3814&page=1&authorid=25887[/url] ...RHEL4-U4-x86_64 下载ftp原载于[url]http://bbs.chinaunix.net/viewthread.php?tid=815086[/url]1:[url]...
  • <p>This attempts to fetch the URL: <code>https://github.com/getantibody/antibody/releases/download/v3.1.1/antibody_Darwin_x86_64.tar.gz</code></p> <p>The releases page for v3.1.1 does not include ...
  • 功能步骤:通过url获取图片缩放图片图片数据放入内存bufferbuffer数据转化为base64编码特点:没有磁盘的存储步骤,图片的处理均在内存中。优势:没有磁盘的io,所以速度相对较快。代码:# coding=utf-8import urllib...
  • <div><p>ENV MONGO_URL="mongodb://url" MONGO_OPLOG_URL="mongodb://oplog_url" ROOT_URL="http://yourapp.com" <p>How to get/set the ROOT_URL, MONGO_URL, MONGO_OPLOG_URL...
  • yarl 这个模块提供了用于url解析和更改的便捷的URL类,yarl 这个模块提供了用于url解析和更改的便捷的URL
  • oracle安装:http://wenku.baidu.com/link?url=7yA21stJo8NEZimeQFnI5LrLjeOUjT_PuP3dMnu_8cDoEXWABq2d6OKk_lVhrQS_q_CofctvUqH6JyKHg8ty90M2rwXykdAPcwaTXwwU4Jy PL SQL链接oralce:...
  • 64-w64-mingw32/include -isystem /mingw64/mingw/include -B/mingw64/x86_64-w64-mingw32/bin/ -B/mingw64/x86_64-w64-mingw32/lib/ -isystem /mingw64/x86_64-w64-mingw32/include -isystem /mingw64/x86_64-w64-...
  • OpenCV3.3和OpenCV3.4源码编译时需要下载的支持包,这个包...set(OPENCV_IPPICV_URL "file:///home/..."),这里file:///home/后面的路径自己完善,指向你存放ippicv_2017u3_lnx_intel64_general_20170822文件的路径。
  • centOS-7-x86_64-Everything-1611.iso

    千次阅读 2018-03-29 20:49:23
    [url]http://mirror.neu.edu.cn/centos/7/isos/x86_64/[/url] CentOS-6.5-x86_64-minimal.iso [url]http://vault.centos.org/6.5/isos/x86_64/[/url] CentOS-6.5-x86_64-bin-DVD1.iso [url]http://...
  • base64模块是用来作base64编码解码的。这种编码方式在电子邮件中是很常见的。它可以把不能作为文本显示的二进制数据编码为可显示的文本信息。编码后的文本大小会增大1/3。 base64模块真正用的上的方法只有8个,...
  • mod_encoding_64.tar.gz

    2013-09-11 09:37:01
    apache+tomcat url中文无法识别
  • <strong>Operating System</strong>: <code>Linux-4.19.0-10-amd64-x86_64-with-debian-10.5 <strong>Locale</strong>: <code>UTF-8 <strong>Branch</strong>: <a href="../tree/master">master <strong>Database...
  • base_64转码

    2017-03-03 13:41:15
    base64的用法详解 大家可能注意到了,网页上有些图片的src或css背景图片的url后面跟了一大串字符,比如: background-image:url(data:image/png;base64, iVBORw0...
  • byte-compiling build/bdist.linux-x86_64/egg/v3n0m/cloudbuster.py to cloudbuster.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/v3n0m/toxin.py to toxin.cpython-37.pyc creating build/bdist....
  • ngx_req_status是一个第三方模块,它用来展示nginx请求状态信息,类似于apache的status,ats的stats_over_http和channel_stats,nginx自带的模块只能显示连接数等等信息,我们...按域名、url、ip等等统计信息 统计总流
  • 最近,我正在学习python。...另外,汤是错误的。我访问了URL。python网络爬虫,当我抓取一个URL时,status_code显示405这里是我的代码:def craw(url):user_agent = 'Mozilla/5.0 ... WOW64; rv:55.0) Gecko/201001...
  • debug: url: https://sourceforge.net/projects/msys2/files/REPOS/MSYS2/86_64/msys.db</code> it should instead direct to: <code>...
  • _int64与unsigned_int64

    千次阅读 2017-10-10 20:22:13
    C++ __int64用法   ...转自: [url]http://www.cnitblog.com/cockerel/archive/2006/08/16/15356.html[/url] C++的64位整数[原]by 赤兔  在做ACM题时,经常都会遇到一些比较大的整数。而...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 33,371
精华内容 13,348
关键字:

url_64