Blog

PHP Registered Hashing Algorithms

PHP Registered Hashing Algorithms and their Hashed Value Length

PHP has a many hashing functions like sha1(), hash(), md5(), etc that can be used to hash a string/number based on certain algorithms i.e. “sha1”, “sha256”, “md5”, etc. You can use hash_algos() function to check a list of registered hashing algorithms. All these function takes a string/number as an argument and output an Alpha-Numeric hashed string of certain length. hash_algos() — Return a list of registered hashing algorithms. Currently PHP supports 46 hashing algorithms. hash_algos() function returns a numerically indexed array containing the list of supported hashing algorithms. Each hashing algorithm has a specific hashed value length. PHP Hash Algorithms Name & Length S.No. Algorithm Name Length 1 md2 32 2 md4 32 3 md5 32 4 sha1 40 5 …

Read More
Generate Random String Number in PHP JavaScript Ruby Python

Generating Random String Using PHP, JavaScript, Ruby, Python

Sometime in the programming world, you may need to generate a random string for any purpose, just like to random password suggestions, random passwords for your users. Today, In this Article we will study how can we achieve that in the easiest and fastest way. Random password / Random String can be generated with fully-custom functions but when we compare that with custom function those uses pre-defined functions of that language then that will be the best and fastest. As pre-defined function’s definitions are already compiled where the fully-custom functions are not compiled. Compiler/Interpreter will compile the code (fully-custom function) before executing that. And that will take a couple of microseconds to make it executable. But when it comes with …

Read More
Control Structures - case Statements in Ruby

Control Structures – case Statements in Ruby

As we have seen in the previous lessons, we can check for multiple conditions using the if/elsif/else expression. A more simplified and flexible option is the case expression, which tests a value in when statements. You can have as many when statements as you need for a single case. Note that the case expression must be closed with the end keyword. case statements are used when you need to make different decisions based on a value.For example: Multiple values can be tested within a single when by separating the values with commas.For example: If you forget to put a comma between two values, Ruby will return a syntax error. syntax error, unexpected tINTEGER, expecting keyword_then or ‘,’ or ‘;’ or …

Read More
Logical Operators – and (&&), or (||), and not (!) in Ruby

Logical Operators – and (&&), or (||), and not (!) in Ruby

Logical operators are used to form more complex criteria that test more than one condition for an if expression. Today in this article we will discuss the logical operators used in Ruby language. Ruby has three logical operators: and (&&), or (||), and not (!). Ruby can use words instead of the logical operator symbols (and, or, not), but those have lower precedence and are generally avoided. Table of Contents and (&&)or (||)not (!) and (&&) A conditional using and evaluates as true if, and only if, all of its operands are true. Otherwise, the entire conditional evaluates to false.For example:

or (||) The or (||) operator evaluates to true if either (or all) of its operands are true, …

Read More
Control Structures – unless Statement in Ruby

Control Structures – unless Statement in Ruby

Control Structure statement is the statement that controls the working flow of any program depending on its condition. Today in this article we will discuss one of the Basic Control Statement of Ruby i.e. unless unless Statements The unless expression is the opposite of an if expression. It executes the line of codes when a conditional is false. You can use an else block with the unless, just like you did with the if expression. The end keyword is also required to close the block.For example: The unless modifiers can also be used to execute code.For example:

Read More
Control Structures – If, elsif, else Statements in Ruby

Control Structures – if, elsif, else Statements in Ruby

Control Structure statement is the statement that controls the working flow of any program depending on its condition. Today in this article we will discuss the Basic Control Statements of Ruby i.e. if, elsif, else. Table of Contents if Statementselsif Statementselse Statements if Statements You can use an if expression to execute the lines of code when a certain condition met. Each if has to have a corresponding end.For Example: The if modifiers can also be used to execute code.For example: elsif Statements The elsif (short form of else if) block is useful when you want to test multiple if conditions.A series of if elsif expressions can have a final else block, which is called if none of the if …

Read More
Install Open SSL Windows10 Localhost

How to Install OpenSSL Light on Windows 10

Table of Contents What is OpenSSL?Download OpenSSL Setup for Windows 10Install OpenSSLClick on the setup (.exe) file and click on next on setup windowAccept the agreement radio button and click the next buttonChoose Installation Drive and click on the next buttonChoose OpenSSL DLL directory and click on the next buttonReview Setup Instructions and click on the next buttonOpenSSL Installed What is OpenSSL? OpenSSL is a general purpose cryptography library that provides an open source implementation of the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) cryptographic protocols. It is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) cryptographic protocols. So to install SSL or to make SSL/https working on any …

Read More
Setup SSL On Localhost

How to add SSL/HTTPS to localhost WAMP Server

Table of Contents Install OpenSSLGenerate self-signed key and certificates for localhostUpdate conf files and include certificates Install OpenSSL Download appropriate OpenSSL as per your windows bit (32-bit / 64-bit) from http://slproweb.com/products/Win32OpenSSL.html and install. While installing the setup it will ask you to select a directory for installation. You can install in any drive. So I am installing in my ‘E’ drive. You can read our article How to Install OpenSSL Light on Windows 10. And after install its path is E:\OpenSSL-Win64 Generate self-signed key and certificates for localhost Open E:\wamp64\bin\apache\apache2.4.33\conf\ folder and create a folder ‘ssl-certs’. Now, in cmd (Command Prompt) navigate to E:\wamp64\bin\apache\apache2.4.33\conf\ssl-certs directory and run following command. You can change the value for -days to the expiry days. I am …

Read More

How to Fix MySQL Error – #1089 – Incorrect prefix key or the storage engine doesn’t support unique prefix keys

Today in this article we will discuss one of the most common errors of MySQL that you may face while creating tables or importing the DataBase to the new server and that is #1089 – Incorrect prefix key; the used key part isn’t a string, the used length is longer than the key part, or the storage engine doesn’t support unique prefix keys.  This occurs due to the syntax error in Create query of Database Table. If you run the below query, you may face the above error and the query will stop working and will not create a Database Table.

And, If you run the below query, you will not face any error and query will work and create …

Read More
MySQL

Reset or Change MySQL root user Password on Ubuntu Linux

Today, in this article we will discuss How you can change / Reset / Set / Update MySQL root user’s password on Ubuntu Linux Server. Sometimes while playing with root user’s privileges to allow its access remotely may change its password. Or if you have forgotten the root user’s password. Then you can not access the MySQL DB without the password. In that case, you need to change/reset it’s MySQL password. Please follow these steps to reset/change the MySQL root user password. Table of Contents Stop The MySQL ServerStart The MySQLd Configuration And Skip The Grant TableLogin To MySQL As ‘root’ UserUpdate MySQL ‘root’ User PasswordFlush & Reload The PrivilegesExit From MySQL Client WindowKill Temporary MySQL ServerStart MySQL Server Stop The MySQL …

Read More