Skip to content

Instantly share code, notes, and snippets.

@sefgit
sefgit / validateInitData.py
Created September 12, 2025 23:38 — forked from Malith-Rukshan/validateInitData.py
Validate Init data of Telegram Mini-App | TypeScript & Python
import hmac
def checkValidateInitData(hash_str, init_data, token, c_str="WebAppData"):
"""
Validates the data received from the Telegram web app, using the
method documented here:
https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
hash_str - the has string passed by the webapp
init_data - the query string passed by the webapp
@sefgit
sefgit / demo-manifest.json
Last active September 14, 2025 06:48
demo-manifest.json
{
"url": "https://mini-app.local:5173",
"name": "CryptoX",
"iconUrl": "https://logoipsum.com/logoipsum-avatar.png"
}
npm install buffer
import { Buffer } from 'buffer';
globalThis.Buffer = Buffer;
npm install -D vite-plugin-node-polyfills
@sefgit
sefgit / sha512.html
Created August 18, 2025 13:47 — forked from grazerblade/sha512.html
SHA512 hash converter via Javascript (from the orig cryptostorm.is website)
<meta name="description" content="Easily calculate SHA-512 algorithms" />
<script type="text/javascript" src="assets/js/sha512.js">
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
//<![CDATA[
function calcSHA()
{
calcHash("SHA-512");
@sefgit
sefgit / simulateNativeLink.js
Created August 14, 2025 12:59 — forked from smitroshin/simulateNativeLink.js
Simulate native link click programmatically in React.js
@sefgit
sefgit / ImpPubKeyFromPriv.c
Created August 4, 2025 05:08 — forked from aleks-f/ImpPubKeyFromPriv.c
CryptoAPI: import public key from private key PEM
#include "windows.h"
#include "wincrypt.h"
#include "stdio.h"
/* This code example:
1) creates a Crypto Service Provider
2) generates keys
3) extracts public key
4) exports private key into PEM
dir "." -Recurse | Unblock-File
Get-ChildItem "." -Recurse -Include *.dll | Unblock-File
@sefgit
sefgit / scroll.html
Last active June 27, 2025 10:21
auto scroll
<html>
<head>
<style>
html {
background-color: black;
color:darkgray;
overflow: hidden;
}
#logger {
padding-top:20px;
@sefgit
sefgit / websocket-hook.js
Created June 22, 2025 10:42
websocket hook
//
// https://stackoverflow.com/questions/70205816/intercept-websocket-messages
//
function listen(fn){
fn = fn || console.log;
let property = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data");
const data = property.get;
@sefgit
sefgit / websocket_proxy.js
Created June 22, 2025 02:35 — forked from Checksum/websocket_proxy.js
Intercepting WebSockets in the browser using JavaScript
const WebSocketProxy = new Proxy(window.WebSocket, {
construct(target, args) {
console.log("Proxying WebSocket connection", ...args);
const ws = new target(...args);
// Configurable hooks
ws.hooks = {
beforeSend: () => null,
beforeReceive: () => null
};