Writing Kong plugins with Go

The Kong, quoting its own documentation , is an open-source API gateway, cloud-native, platform-agnostic, scalable API Gateway distinguished for its high performance and extensibility via plugins. Kong has a lot of official plugins that allow us to customize what we need, and when there aren’t any available, you can build your own.

The default language for building plugins its Lua, but other languages are supported, including Go. I don’t have much experience writing code with Lua, so using Go allows me a higher development speed and quality on my plugins.

Introduction to Concurrency in Go

One of the best Go features is how easy we can use concurrency. The language gives us goroutines, which are like lightweight threads managed by the Go runtime. It help us to run several functions at the same instant and is very helpful if you wish to improve the performance of your application.

Using this feature is easy as adding the go keyword before any function call. This will make the function run concurrently. To make it simpler, let’s show you the code. Here I’ve written the SleepSort algorithm, which uses the sleep method to sort each element in its place.

RSA in Ruby for beginners

Introdução

RSA is a public/private encryption algorithm and it is based on the difficulty of the factorization of the product of two large prime numbers. It was named after its creators Rivest, Shamir, and Adleman.

It is an expensive algorithm, computationally speaking, and because of this, it is not common to use it directly, but it is still widely used in the market and is one of the most important encryption algorithms. As an example, OpenSSL implements this algorithm for generating keys and it is commonly used for encrypting SSL certificates or SSH keys.

Implementing the Caesar Cipher in Ruby

Caesar cipher is the simplest and most widely known encryption technique. It is also known as Caesar’s cipher, shift cipher, Caesar’s code, Caesar shift, or ROT N (ROT13 is the most famous one, shifting letters by 13).

It is very simple because it just works for letters between A and Z, ignoring all special characters, such as dots, whitespaces, question marks, and special letters, like Ç or Á.

Starting our implementation, we need to create a class that will know what we want to cipher and how many rotations we will do.