Author Archives: smike19

Golang. UTF-8 String from unsafe pointer

It is a continuation of previous post “Compare storage of string in memory for c++ and golang using dgb” where gbg debugger was used to read characters defined in string variable directly from memory. The example below shows how to read string bytes from memory using unsafe pointer. String encoding is UTF-8, and it contains… Read More »

Calculate MD5 programmatically (c++ and golang)

MD5 is 128 bit hash digest calculated by Message Digest Method 5 algorithm. It is not so secure as SHA-256 algorithm but significantly faster. It is still widely used as thumbprint to verify data integrity and detect accidental data corruption. Here is c++ example how to calculate MD5 hash of string using openssl API. Templates… Read More »

Calculate SHA-256 programmatically (c++ and golang)

SHA-256 is 256 bit hash value calculated by SHA-2 (Secure Hash Algorithm 2). SHA-256 is used in some of the multiple well known authentication and encryption protocols, including SSL, TLS, IPsec, SSH, and PGP. Also it is used for secure password hashing and cryptocurrency transaction verification. Here is c++ example how to calculate SHA-256 has… Read More »

How to get openssl cipher list programmatically

The cipher list may be retrieved using “openssl cipher” command. This command has multiple options to filter output. The same is possible to do programmatically using openssl API. Here is c++ example how to programmatically obtain a list of available ciphers with appropriate cryptographic protocols they belong to. The code was implemented and tested on… Read More »

Simple method of bash script step debugging

I always wanted to be able to debug bash scripts just like any other code and I did not know how to do in for very long time. However it is easy to do using trap command which may intercept different kind of signals and exceptions. Adding trap in some place of your script you… Read More »

Openssl BIO API, file saving and reading examples

The acronym BIO stands for Basic Input/Output. It is multipurpose API for various types of input and output operations, including file, memory buffer, networking. The main header file for BIO methods is bio.h, binary linking references are presented in library. Below presented 3 examples of BIO API file usage which create and read 3… Read More »

How detach forked process from parent process

A child forked process in Linux inherits most of parent process attributes, such as file descriptors. Basically a child process basically represents a copy of the parent. setsid() function may help to break this inherency. “man 2 setsid” gives us the following information about this function: setsid() creates a new session if the calling process… Read More »

HTTP 418 response code.

The HTTP 418 code description is “I’m a teapot”. in other words this response code means that the HTTP server refuses to brew coffee because it is, permanently, a teapot. This code is defined in RFC 2324 and RFC 7168 (section 418 I’m a teapot). This code was defined as April Fools’ joke and usually… Read More »

Removing from Chromebook

I bought new Chromebook at Costco and found that my Chrome browser redirects me to search engine. I did not know anything about trovi and after googling I found that trovi is classified as browser hijacker which modifies a web browser’s settings without my permission. Definitely it does not look good. Before removing trovi… Read More »