Posts

Kotlin MD5, SHA-1, SHA-256, SHA-384, SHA-512, and PBKDF2 Hashing Example

Image
What does Hashing mean? A secure password hash is an encrypted sequence of characters obtained after applying certain algorithms and manipulations on utilizer-provided passwords, which are generally very impotent and facile to conjecture. Please remember that once this password hash is engendered and stored in the database, you can not convert it back to the pristine password. Using MD5 algorithm The MD5 message-digest algorithm is a widely used hash function engendering a 128-bit hash value. Albeit MD5 was initially designed to be utilized as a cryptographic hash function, it has been found to suffer from extensive susceptibilities. It can still be utilized as a checksum to verify data integrity, but only against unintentional corruption. It remains felicitous for other non-cryptographic purposes, for example for determining the partition for a particular key in a partitioned database. MD5 Example: import java.lang.StringBuilder import java.nio.charset.StandardCharsets import java.

Kotlin - RSA + AES a double layer security system

Image
 Hello everyone, Today we will learn a double layer security system using RSA+AES, with the help of architecture visualization and one Kotlin example. Encryption's primary purpose is to protect against brute force attacks. It is composed of a cipher, the message/data, and a key (the password). With a wide range of free tools available like(Aircrack-ng, John the Ripper, Rainbow Crack, L0phtCrack ), even baby hackers can attempt to hack passwords using brute force. In my opinion, as a layperson in cryptography, multiple double-layer encryptions may not increase security, but it may slow down attackers. Using encryption may cause performance issues. Or maybe not. It really depends on how you use it. If you understand just how "expensive" each part of your enterprise encryption operation is, it's possible you can avoid the expensive parts and dramatically increase the performance of your applications. Let's see the architecture of the RSA + AES system This is the top

Iterate over the Map, List, and Set in Kotlin!How?

Hello everyone, Today we will learn how to operate over Map, List, and Set in Kotlin. In Kotlin, we can loop a Map in the following ways: 1. Using for loop 2. Using forEach 3. Using Iterator Example: fun main(args : Array<String>) { val items = HashMap<String, String>() items[ "1" ] = "JAVA" items[ "2" ] = "KOTLIN" items[ "3" ] = "GO" items[ "3" ] = "PYTHON" //for loop example println ( " \n -- Example 1.1 -- " ); for ((k, v) in items) { println ( " $ k = $ v " ) } // forEach example println ( " \n -- Example 1.2 --" ); items. forEach { (k, v) -> println ( " $ k = $ v " ) } //Iterator example println ( " \n -- Example 1.3 --" ); val itr = items. keys .iterator() while (itr.hasNext()) { val key = itr.next() val value = items[key] print

WebSocket + Kotlin + Spring boot simple application example

Image
Hello everyone, Today we will learn how to develop a Simple Kotlin - Spring Boot - WebSocket, chat application. Why WebSocket? We already know traditional HTTP requests are unidirectional and heavy. But WebSocket is bi-directional. The initial connection is using HTTP, then this connection gets upgraded to a socket-based connection. This single connection is then used for all future communication. The WebSocket message data exchange is much lighter compared to HTTP. Project Directory: Pom.xml[maven] <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < parent > < groupId > org.springframework.boot </ groupId > < artifactId > spr