Skip to content

Instantly share code, notes, and snippets.

@jasny
jasny / sha256-hmac.md
Last active December 12, 2023 12:32
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@gdamjan
gdamjan / ssl-check.py
Last active April 14, 2024 07:16
Python script to check on SSL certificates
# -*- encoding: utf-8 -*-
# requires a recent enough python with idna support in socket
# pyopenssl, cryptography and idna
from OpenSSL import SSL
from cryptography import x509
from cryptography.x509.oid import NameOID
import idna
from socket import socket
@Miserlou
Miserlou / flask_binary.py
Created February 17, 2017 19:07
Flask serving binary data example
import io
from flask import Flask, send_file
app = Flask(__name__)
@app.route('/logo.jpg')
def logo():
"""Serves the logo image."""
with open("logo.jpg", 'rb') as bites:
@heskyji
heskyji / hmac_sha1.py
Created September 17, 2015 01:08
Generate HMAC-SHA1 Signature using Python 3
import hashlib
import hmac
import base64
def make_digest(message, key):
key = bytes(key, 'UTF-8')
message = bytes(message, 'UTF-8')