Merge pull request #14 from TiagoRG/dev-tiagorg

This commit is contained in:
Tiago Garcia 2023-02-18 16:09:07 +00:00 committed by GitHub
commit d8d526d6af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1949 additions and 3 deletions

View File

@ -5,5 +5,7 @@
* [Slides](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/1semestre/iei/tema01/tema-1-criptografia.pdf)
* [Guião](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/1semestre/iei/tema01/guide-1-cripto.pdf)
### Nota: código bastante incompleto porque a biblioteca do PyCrypto não gosta de trabalhar :skull:
---
*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new)

View File

View File

@ -0,0 +1,12 @@
import os
import sys
from Crypto.Cipher import AES
def main(args=None):
cipher = AES.new(os.urandom(16), AES.MODE_ECB)
print(cipher.encrypt(b'Hello World!'))
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -0,0 +1,16 @@
import hashlib
import sys
def main(args=None):
with open(args[0], 'rb') as f:
buffer = f.read(512)
h = hashlib.sha1()
while len(buffer) > 0:
h.update(buffer)
buffer = f.read(512)
print(h.hexdigest())
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -0,0 +1,14 @@
import sys
from Crypto.Hash import SHA256
def main(args=None):
with open(args[0], 'rb') as f:
buffer = f.read()
h = SHA256.new()
h.update(buffer)
print(h.hexdigest())
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -0,0 +1,22 @@
# Screw 1.4 :skull:
import codecs
import os
import sys
from Crypto.Cipher import ARC4
def main(args=None):
with open(args[0], 'r') as f:
text = f.read(2048)
cipher = ARC4.new(bit_array_from_str(args[1]))
cryptogram = cipher.encrypt(text)
os.write(1, cryptogram)
print()
def bit_array_from_str(s):
return [codecs.encode("hex") for elem in s]
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -3,8 +3,8 @@
---
## Índice
| Aula nº | Tópicos |
|--------------------------------------------------------------------------|------------------------------|
| Aula nº | Tópicos |
|-------------------------------------------------------------------------------------|---------------------|
| [01](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/lsd/aula01) | Introdução às FPGAs |
---
*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
# Programação Orientada a Objetos
### Projetos + resoluções de exercícios organizados por aulas
### Projetos + resoluções de exercícios
### Linguagem usada: [Java](https://www.java.com/en/)
---

View File

@ -0,0 +1,5 @@
# Programação Orientada a Objetos
## Guiões das aulas práticas
---
*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new)

View File

@ -0,0 +1,5 @@
# Programação Orientada a Objetos
## Slides das aulas teóricas
---
*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new)