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:
| import React, {Component} from 'react'; | |
| import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; | |
| import _ from 'lodash'; | |
| const dataTable = _.range(1, 60).map(x => ({id: x, name: `Name ${x}`, surname: `Surname ${x}`})); | |
| // Simulates the call to the server to get the data | |
| const fakeDataFetcher = { | |
| fetch(page, size) { | |
| return new Promise((resolve, reject) => { |
| #!/bin/bash | |
| # Sign a file with a private key using OpenSSL | |
| # Encode the signature in Base64 format | |
| # | |
| # Usage: sign <file> <private_key> | |
| # | |
| # NOTE: to generate a public/private key use the following commands: | |
| # | |
| # openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048 | |
| # openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem |
| const {TokenVerifier} = require('jsontokens'); | |
| const {randomBytes, createHash} = require('crypto'); | |
| const secp256k1 = require('secp256k1'); | |
| function signer(privateKey, data) { | |
| const hash = createHash(`sha256`).update(data).digest(); | |
| const signature = secp256k1.sign(hash, privateKey).signature.toString('base64'); | |
| return signature; | |
| } |
| #!/usr/bin/env python3 | |
| """ | |
| License: MIT License | |
| Copyright (c) 2023 Miel Donkers | |
| Very simple HTTP server in python for logging requests | |
| Usage:: | |
| ./server.py [<port>] | |
| """ | |
| from http.server import BaseHTTPRequestHandler, HTTPServer |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <uv.h> | |
| //based on https://gist.githubusercontent.com/snatchev/5255976/ | |
| //raw/8392c42d719bb775053036e32b21affdf932c1b7/libuv-tcp-client.c | |
| //which was based on libuv 0.1, there is considerable difference there. | |
| static void on_close(uv_handle_t* handle); | |
| static void on_connect(uv_connect_t* req, int status); | |
| static void on_write(uv_write_t* req, int status); |
In your command-line run the following commands:
brew doctorbrew update| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <uv.h> | |
| #define DEFAULT_PORT 7000 | |
| #define DEFAULT_BACKLOG 128 | |
| uv_loop_t *loop; | |
| struct sockaddr_in addr; |
| import Cocoa | |
| import MetalKit | |
| @NSApplicationMain | |
| class AppDelegate: NSObject, NSApplicationDelegate, MTKViewDelegate { | |
| weak var window: NSWindow! | |
| weak var metalView: MTKView! | |
| let device = MTLCreateSystemDefaultDevice()! | |
| var commandQueue: MTLCommandQueue! | |
| var pipelineState: MTLRenderPipelineState! |
| // Server side C program to demonstrate Socket programming | |
| #include <stdio.h> | |
| #include <sys/socket.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <netinet/in.h> | |
| #include <string.h> | |
| #define PORT 8080 | |
| int main(int argc, char const *argv[]) |