Blog

How To Remove Classes By Prefix In Vanilla JavaScript

Removing a class from an HTML-Element with JavaScript is easy enough. You could use jQuery for it by calling 1 $(node).removeClass(className); or, just as simple, go vanilla with: 1 2 var node = document.getElementById(id); node.classList.remove(className); But what if you wanted to remove all classes starting with a prefix? Assume we have a DOM-Node like this:
By paranerd | Oct 4, 2018

Decrypting Files With AES-256 In PHP

This post is part of a series about symmetric encryption with AES-256 in PHP.

In this last part of our series we’re going to learn how to decrypt files we previously encrypted using our Crypto class.

By paranerd | Oct 1, 2018

Decrypting Text With AES In JavaScript

After encrypting text in the previous post, here’s how you get your plaintext back. The code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 decrypt: function(encryptedString, secret) { // Separate payload from potential hmac var separated = encryptedString.
By paranerd | Oct 1, 2018

Encrypting Files With AES-256 In PHP

This post is part of a series about symmetric encryption with AES-256 in PHP. Now that we covered how to encrypt text in PHP, you might want to also be able to encrypt files. Luckily, most of the logic to do that already exists in the class we created, so implementing this feature is relatively easy.
By paranerd | Oct 1, 2018

Encrypting Text With AES-256 In JavaScript

Maybe you followed my series on symmetric encryption with AES in PHP. You can check it out here if you’re interested! What if I told you, that you don’t even need a server to do that but might as well encrypt text using AES right in your browser? Sounds crazy? Well, you’re in for a treat!
By paranerd | Oct 1, 2018

Decrypting Text With AES-256 In PHP

This post is part of a series about symmetric encryption with AES-256 in PHP.

After encrypting text in the previous post, we now want to be able to decrypt that as well.

By paranerd | Sep 28, 2018

Encrypting Text With AES-256 In PHP

This post is the first part of a series about symmetric encryption with AES-256 in PHP. There are plenty usecases for having encryption in your application, but be aware of the golden rule of cryptography: If you don’t know what you’re doing, don’t do it! Simply labeling your application “AES256-encrypted” doesn’t necessarily mean, it’s secure because you may have intruduced attack vectors in your implementation.
By paranerd | Sep 28, 2018

How To Build A QR-Code-Generator In PHP

I’m sure all of you know Quick Response Codes (or QR-Codes for short). They’re everywhere and a great way to encode information that’s hard to read and/or remember for humans in a way machines can process. There are plenty of online services that will generate QR-codes for us. But what if we wanted to be able to do this ourselves to use such a feature in our own application?
By paranerd | Sep 26, 2018

How To Center A DIV horizontally and vertically

When searching the web for ways to center a DIV I found a ton of suggestions. Many kind of solved one problem but at the same time introduced others, some made the code unreadable and others straight up didn’t work at all. Eventually I got frustrated and decided to tinker around for a couple hours myself on a problem that seems like there should be a native solution for it - but there isn’t.
By paranerd | Sep 25, 2018

How To Backup A (Wordpress-) Server

Backups are crucial. I hope we agree on that one. When I started this website, one of the major things that occupied my mind was “How do I make sure, all the work I put into this project is safe from an attack, system failure or me accidentaly clicking ‘Delete All!
By paranerd | Sep 24, 2018