For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
| # Generate ed25519 privkey | |
| openssl genpkey -algorithm ed25519 -out privkey.pem | |
| # export its pubkey | |
| openssl pkey -in privkey.pem -pubout -out pubkey.pem | |
| # Generate RSA privkey | |
| openssl genrsa -des3 -out private.pem 2048 | |
| # export its pubkey | |
| openssl rsa -in private.pem -outform PEM -pubout -out public.pem |
| # references: | |
| # Learning by doing: Writing your own traceroute in 8 easy steps (Ksplice Blog) | |
| # https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your | |
| # Edited by: Alejandro Almira <laboral at alejandroalmira.com> | |
| import datetime | |
| import socket | |
| import sys |
| ## Common | |
| ```` | |
| export OPT=/opt | |
| export BUILDS=/some/where/mini_linux | |
| mkdir -p $BUILDS | |
| ```` | |
| ## Linux kernel |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <netinet/tcp.h> | |
| #include <sys/socket.h> | |
| #include <sys/types.h> | |
| #include <netinet/in.h> |
| #include <stdio.h> /* fprintf() */ | |
| #include <stdlib.h> /* exit() */ | |
| #include <sys/types.h> /* socket(), wait4() */ | |
| #include <sys/socket.h> /* socket() */ | |
| #include <netinet/in.h> /* struct sockaddr_in */ | |
| #include <sys/resource.h> /* wait4() */ | |
| #include <sys/wait.h> /* wait4() */ | |
| #include <pthread.h> /* pthread_create */ | |
| #include <netdb.h> /* getnameinfo() */ | |
| #include <string.h> /* strlen() */ |
| /* Compile with: g++ -Wall –Werror -o shell shell.c */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> | |
| #include <sys/wait.h> |
| import urllib | |
| import shutil | |
| import re | |
| from pathlib import Path | |
| from bs4 import BeautifulSoup | |
| # target page containing links to the image files | |
| target_page = 'http://example.ca/image_links.php' | |
| # local path |
| #include <stdio.h> | |
| void DumpHex(const void* data, size_t size) { | |
| char ascii[17]; | |
| size_t i, j; | |
| ascii[16] = '\0'; | |
| for (i = 0; i < size; ++i) { | |
| printf("%02X ", ((unsigned char*)data)[i]); | |
| if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') { | |
| ascii[i % 16] = ((unsigned char*)data)[i]; |