Skip to main content

Posts

Showing posts from September, 2017

Protecting passwords with Argon2 in PHP 7.2

Protecting passwords with Argon2 in PHP 7.2 PHP 7.2 will be released  later this year (2017) . This version contains some interesting additions, including two new security features: support of the  Argon2  password hash algorithm, and the  ext/sodium  extension wrapping the  libsodium  library. With these new features, PHP is the first programming language to adopt  modern cryptography  in its standard library. In this article, we demonstrate the usage of the Argon2 password hash algorithm. Installation of PHP 7.2 If you are reading this article before the general availability of 7.2, you need to compile PHP to use that version. You can download the source code from  the PHP downloads site . Today, 17 August 2017, the most recent available version is 7.2.0 Beta 3 (file  php-7.2.0beta3.tar.gz ). Before compiling PHP, you need to install the  argon2  library. If you are using a Debian/Ubuntu Linux distribution...

Are Bitwise Operators Still Relevant in Modern PHP?

Are Bitwise Operators Still Relevant in Modern PHP? Many of you probably scratched your heads reading this title. “Bitwhat?” In this article, we’ll look at what bitwise operators are, and whether or not their use is still relevant in this modern age of computing. Example Use Case Bitwise operators are  listed here , but to really drive the example home, we’ll focus on just one: the  bitwise and  ( & ). An example made it click for me. So that’s what we’ll do – dive straight into an example. Imagine you have a website on which a given user can have specific permissions. For example, a magazine like SitePoint: a author can CRUD drafts, and and edit their profile. an editor can, in addition to the above, CRUD drafts and finished posts, and CRUD author profiles. an administrator can, in addition to the above, add administrator permissions. Since a user can have multiple permissions, there are several ways of defining permissions in a database and the...