Skip to content

Instantly share code, notes, and snippets.

@cvzi
cvzi / base64encode.js
Last active October 24, 2019 11:52 — forked from stubbetje/base64.js
Base64 encode in javascript
function base64encode (s) {
// from https://gist.github.com/stubbetje/229984
const base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split('')
const l = s.length
let o = ''
for (let i = 0; i < l; i++) {
const byte0 = s.charCodeAt(i++) & 0xff
const byte1 = s.charCodeAt(i++) & 0xff
const byte2 = s.charCodeAt(i) & 0xff
o += base64[byte0 >> 2]
@cvzi
cvzi / urlsigner.py
Last active January 15, 2021 13:24 — forked from christ0pher/gist:f2c4748a09ed31cf71a8
Google URL-signing and checking for Python3
from requests.packages.urllib3.util import parse_url
from urllib.parse import quote, unquote
import hashlib
import hmac
import base64
""" Sign and check a URL using the client_secret """
__author__ = 'christopher@levire.com, cuzi@openmail.cc'