Instantly share code, notes, and snippets.
Pietro Squilla
ScratchyCode
3
followers
·
2
following
View GitHub Profile
ScratchyCode
/
Sierpinski.py
Created
September 21, 2025 17:55
Grafica con metodo stocastico il frattale di Sierpinski sulla Casio fx-CG50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
from casioplot import * |
|
import random |
|
|
|
def gioco_del_caos(): |
|
clear_screen() |
|
|
|
try: |
|
# Chiediamo il numero di punti da disegnre |
|
n_str = input("Num punti: ") |
|
if n_str == "": |
ScratchyCode
/
NotAES.py
Created
September 15, 2025 19:56
Test delle primitive crittografiche classiche (post crittoanalisi)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
# Coded by Scratchy |
|
import sys |
|
import re |
|
|
|
# ================================================================================ |
|
# FUNZIONI DI TRASPOSIZIONE |
|
# Queste funzioni gestiscono la creazione di griglie e la trasposizione a colonna |
|
# ================================================================================ |
|
|
|
def hex_to_grid(hexstr, cols): |
ScratchyCode
/
nRoots.py
Created
June 11, 2025 02:27
Analisi di convergenza numerica tramite implementazioni python dei metodi babilonese e di Newton per il calcolo delle radici quadre ed n-esime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
def radice_ennesima_newton(N, n, x0_initial, tolleranza=1e-7): |
|
""" |
|
Calcola la radice n-esima di un numero N usando il metodo di Newton, |
|
fermandosi quando la convergenza raggiunge la tolleranza specificata. |
|
|
|
Args: |
|
N (float): Il numero di cui calcolare la radice. |
|
n (int): L'indice della radice (es. 2 per radice quadrata, 3 per cubica). |
|
x0_initial (float): La stima iniziale x_0 per l'algoritmo di Newton. |
|
tolleranza (float): La massima differenza accettabile tra due iterazioni successive. |
ScratchyCode
/
keyHill.c
Last active
June 16, 2025 16:33
Ricerca chiavi cifrario di Hill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
// Coded by Pietro Squilla |
|
// Semplifica l'uso del cifrario di Hill con carta e penna ricercando matrici con det = +-1; |
|
// osservazione: se la matrice ha determinante 1 o -1 la sua inversa conterrà numeri interi |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <time.h> |
|
#include <math.h> |
|
|
|
// grandezza alfabeto -> modulo base = MASSIMO + 1 |
|
#define MINIMO 0 |
ScratchyCode
/
Hill.py
Last active
January 30, 2023 02:13
Script utili per applicare il cifrario di Hill con carta e penna
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
# Coded by Scratchy |
|
# inserisci i coefficienti di una matrice chiave e gli elementi di n vettori da moltiplicare modularmente |
|
import numpy as np |
|
|
|
n = int(input("Inserisci la dimensione della matrice quadrata: ")) |
|
modulo = int(input("Inserisci il modulo di base (elementi dell'alfabeto): ")) # consigliato: 26 + 3 |
|
matrice = np.zeros((n,n)) |
|
|
|
# input dei coefficienti della matrice |
|
for i in range(n): |
ScratchyCode
/
realRand.c
Created
January 2, 2023 13:27
Generatore di numeri non pseudo-casuali
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
// Coded by ScratchyCode |
|
#include <stdio.h> |
|
#include <unistd.h> |
|
#include <stdlib.h> |
|
#include <signal.h> |
|
|
|
long long int contatore = 0; |
|
|
|
void stampa(int segnale); |
ScratchyCode
/
Vigenere.c
Created
December 28, 2022 12:25
Il cifrario Vigenere diventa un cifrario perfetto con opportuni vincoli sulla chiave, quelli del cifrario Vernam. I crittogrammi prodotti possono essere decifrati anche con il disco di Leon Battista Alberti che usa l'alfabeto latino esteso.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
/* |
|
Coded by ScratchyCode; |
|
|
|
Vigenere = Vernam se: |
|
- chiave lunga quanto il testo in chiaro |
|
- chiave con lettere casuali |
|
- chiave one time pad |
|
*/ |
|
#include <stdio.h> |
|
#include <stdlib.h> |
ScratchyCode
/
AEString.sh
Last active
December 7, 2022 17:15
Cifra e/o decifra agilmente un messaggio con AES in modalità CBC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
#!/bin/bash |
|
|
|
# cattura CTRL+Z |
|
trap '' SIGTSTP |
|
|
|
# display messaggio e metti in pausa |
|
pause(){ |
|
local m="$@" |
|
echo "$m" |
|
read -p "Premi [INVIO] per continuare..." key |
ScratchyCode
/
Anagram.c
Created
November 24, 2022 20:04
Cifrario a permutazioni pseudocasuali
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
// Coded by ScratchyCode |
|
// Cifrario a permutazioni pseudocasuali in stile CR4 |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <string.h> |
|
#include <math.h> |
|
#include <stdbool.h> |
|
|
|
#define LIM 10000 |
ScratchyCode
/
cPlot.c
Last active
September 28, 2022 22:21
Plotting complex functions. To launch run in terminal: bash start.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
|
// Coded by Scratchy |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <math.h> |
|
#include <complex.h> |
|
#include <tgmath.h> |
|
|
|
//#define EPSILON 0.0001 |
|
|
|
void polari(long double a, long double b, long double *rho, long double *theta); |
Newer
Older