https://github.com/vittoriopiotti/fermatandrsa-java
Soluzione software in Java che genera e salva su file i numeri primi con algoritmo di Fermat e algoritmo di crittografia RSA
https://github.com/vittoriopiotti/fermatandrsa-java
fermat fermat-factorization flatlaf java rsa rsa-cryptography rsa-decryption rsa-encryption software
Last synced: 11 months ago
JSON representation
Soluzione software in Java che genera e salva su file i numeri primi con algoritmo di Fermat e algoritmo di crittografia RSA
- Host: GitHub
- URL: https://github.com/vittoriopiotti/fermatandrsa-java
- Owner: vittorioPiotti
- License: gpl-3.0
- Created: 2024-08-21T20:11:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-30T12:38:40.000Z (over 1 year ago)
- Last Synced: 2025-03-25T11:38:57.696Z (about 1 year ago)
- Topics: fermat, fermat-factorization, flatlaf, java, rsa, rsa-cryptography, rsa-decryption, rsa-encryption, software
- Language: Java
- Homepage: https://drive.google.com/file/d/1IVb3ctowyLbrHMg7zlFN-Zv7If_51uzH/view?usp=sharing
- Size: 2 MB
- Stars: 52
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Fermat-And-RSA
Soluzione software in Java che genera e salva su file i numeri primi con algoritmo di Fermat e algoritmo di crittografia RSA
> [!NOTE]
> Progetto scolastico π Β· β
£
> [!Warning]
> Presenza di BUG nell'UI
---
## Javadoc
Link al javadoc: [(link)](https://vittoriopiotti.altervista.org/FermatAndRsaJava/index.html)
## Preview
Video di Test [(link)](https://drive.google.com/file/d/1IVb3ctowyLbrHMg7zlFN-Zv7If_51uzH/view?usp=sharing)
---

## Responsive
|
|
|
|-|-|
|Small|Large|
## Utilizzo
1. Seleziona schermata di "Test PrimalitΓ "
2. Genera i numeri primi con algoritmo di Fermat
3. Salva su file i numeri primi
4. Seleziona schermata di "Algoritmo RSA"
5. Carica il file con i numeri primi
6. Cifra o decifra un messaggio
## Snippet Fermat Algorithm
```java
public void algoritmoFermat(){
long start; //tempo inizio calcolo numeri primi
long end; //tempo fine calcolo numeri primi
boolean checkPrimo; //verifica se un numero Γ¨ primo
//check = true: primo
//check = false: composto
start = System.currentTimeMillis(); //tempo inizio calcolo numeri primi
//ciclo for di i che scorre da min a max
for (
BigInteger i = min; //Γ¨ il numero di cui si verifica la primalitΓ
i.compareTo(max) <= 0;
i = i.add(BigInteger.valueOf(1))
) {
incrementProgressBar.run();
checkPrimo = true;
//ciclo for annidato di j che scorre da 2 al divisore massimo
for (
BigInteger j = BigInteger.valueOf(2); //Γ¨ il dvisore del numero per la verifica della primalitΓ
j.compareTo(BigInteger.valueOf(10)) <= 0; //j compareTo fino al numero
j = j.add(BigInteger.valueOf(1)))
//verifica se j divisore di i ed in caso aggiorna check = false
{
if (Thread.currentThread().isInterrupted()) {
end = System.currentTimeMillis(); //tempo fine calcolo numeri primi
time = Math.abs(start - end) / 1000.0; //tempo durata calcolo numeri primi
return;
}
if (!j.modPow(i.subtract(BigInteger.valueOf(1)), i).equals(BigInteger.valueOf(1))) checkPrimo = false;
}
if (checkPrimo){
results.add(i.toString());
appendResult.run();
}
}
end = System.currentTimeMillis(); //tempo fine calcolo numeri primi
time = Math.abs(start - end) / 1000.0; //tempo durata calcolo numeri primi
}
```
## Albero di Path
```bash
$ tree
.
βββlib
β βββ flatlaf-3.2.5.jar
βββsrc
βββ org
βββ app
βββ applications
β βββ encryption
β β βββ ReadFile.java
β β βββ TestEncryption.java
β βββ primality
β βββ SavePrimality.java
β βββ TestPrimality.java
βββ windows
β βββ dependencies
β β βββ components
β β β βββ encryption
β β β β βββ dialogs
β β β β β βββ WinErrorInEncryption.java
β β β β β βββ WinErrorOutEncryption.java
β β β β βββ panels
β β β β β βββ WinInEncryption.java
β β β β β βββ WinOutEncryption.java
β β β β β βββ WinSaveEncryption.java
β β β β βββ WinEncryption.java
β β β βββ primality
β β β β βββ dialogs
β β β β β βββ WinErrorInPrimality.java
β β β β β βββ WinErrorOutPrimality.java
β β β β βββ panels
β β β β β βββ WinInPrimality.java
β β β β β βββ WinOutPrimality.java
β β β β β βββ WinSavePrimality.java
β β β β βββ WinPrimality.java
β β β βββ WinHome.java
β β βββ managers
β β βββ WinManagerEncryption.java
β β βββ WinManagerPrimality.java
β βββ WinManager.java
βββ App.java
βββ Main.java
```
## Licenze
### Fermat And RSA
**Copyright** 2024 Vittorio Piotti [(GitHub page)](https://github.com/vittorioPiotti) [(Personal page)](https://vittoriopiotti.altervista.org/)
**Version** [v1.0.0](https://github.com/vittorioPiotti/FermatAndRSA-Java/releases/tag/1.0.0)
**License** [GPL-3.0](https://github.com/vittorioPiotti/Fermat-And-RSA/blob/main/LICENSE.md)
---
### FlatLaf
**Copyright** 2024 JFormDesigner GmbH
**Version** [v3.2.5](https://mvnrepository.com/artifact/com.formdev/flatlaf/3.2.5)
**License** [Apache License 2.0](https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)