Skip to content

Instantly share code, notes, and snippets.

View viewv's full-sized avatar
🎯
Focusing

X=>Z viewv

🎯
Focusing
View GitHub Profile
@viewv
viewv / attack_Vigenère.py
Created December 20, 2022 07:24
Attack Vigenère cipher
CIPHER = '''
KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGILTXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWCRXIZ
AKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJUWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXGSFRLSWC
WSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDISPZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNRWXC
VYCGAONWDDKACKAWBBIKFTIOVKCGGHJVLNHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWPFDTKF
QIYCWHJVLNHIQIBTKHJVNPIST
'''
CIPHER = ''.join(CIPHER.split())
frequency = {
'A': 0.08167,
@viewv
viewv / exponentiating_by_squaring_mod.py
Created November 25, 2022 08:45
Exponentiating by squaring with mod
def exp_mod(base,n,mod):
ans = 1
while n:
if n & 1:
ans = (ans * base) % mod
base = (base * base) % mod
n >>= 1
return ans
@viewv
viewv / MixColumns.py
Created November 20, 2022 11:18
MixColumns
PD = [
[0x02, 0x03, 0x01, 0x01],
[0x01, 0x02, 0x03, 0x01],
[0x01, 0x01, 0x02, 0x03],
[0x03, 0x01, 0x01, 0x02],
]
def gf3mpy(x, y):
p = 0b100011011
m = 0
@viewv
viewv / des.py
Last active November 16, 2022 05:15
DES
import random
PC1 = [57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4]
# viewv zsh config
### Sys level fix
# Local Fix
export LC_ALL=en_US.UTF-8
# Add Proxy
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
### End sys fix
### Zinit's
@viewv
viewv / Public Key
Created May 24, 2020 16:26
2020-05-25 at 00:26:41 CST
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAojvho3WSWZEMnPhJiwqAZaTqCIO1BddRhvxMITTqsjkQUTo7141L/3vjE9BHRl9qvkwqZNyPkaFsVtUioiSCy7jUNea5Jt3i/5UHv7aTJM1aHcFTDyH+leUly60Ovdv8fyGc7WA3HHUM93XyW79dWBhobYrJZMkUMZHXzmqYJw5ozX1ZU+be+qMN8CO9B7YUxdB4Lr7WwcqN7a9TR8ZwwRRp/ZteQ27KFpg4gHR8Aiov24Ey6iNvQ56JqwBFf2ePO/IuYXxYX1X+4VRIBsUMF2XjEu4ms6Lga0JP5YAcnSUR8Acyy5h8UG0kcadUOznl5u4Wg7+CQBjFkakpYBeDDwIDAQAB
@viewv
viewv / Public Key
Created May 24, 2020 16:22
2020-05-25 at 00:22:41 CST
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA12zjdduKe6CLWALQPllROYKyr+72TAoJhgw1K5aOYYm8kG8fjfnd7DPZtSbzEVJDId7dUyeo9soXIYLNvkq9rWDYzPkVprQvgvgnYlhgVrnH6binXq+xw15Rc+krzTHQ7V6GmSmDH9IhR7LSf1WSI7279WlkoYG3oPMBG++6IoDclBhlCUk1U07XeldFeMPnLiwNZ2Tg0RNG6T+yA7ML8TYkTYnQmn4cFMotrhQQcHYz9kd2CkpWdH8RSINGuVTeQk+RWlyrfkUM+MYYXTf4vzSOLyJqA5GZB7KUtVuM7Sdon87lQQcIZ0a5fN0zXNh6Nw+usXcoNugEnCt7gCAOhwIDAQAB
@viewv
viewv / sout.java
Created April 30, 2020 14:25
Prints a string to standard out
System.out.println("Hello World");
@viewv
viewv / updater.py
Created November 30, 2019 07:33
A simple Clash config file downloader for Linux in python.
import os
import requests
from ruamel import yaml
from tqdm import tqdm
URL = "Your Url"
PATH = "Your Config Path"
NAME = "config.yml"
IPHOST = "127.0.0.1:1234" # external-controller
@viewv
viewv / ffmpeg-extract-keyframes.sh
Created September 27, 2019 09:39 — forked from savvot/ffmpeg-extract-keyframes.sh
Extract only keyframes (I-frames) from video to images with console ffmpeg
ffmpeg -ss <start_time> -i video.mp4 -t <duration> -q:v 2 -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync 0 frame%03d.jpg