Skip to main content

Posts

Showing posts from April, 2018

Setting up a NoSQL database with MongoDB

This post details the setup process for a NoSQL database with MongoDB. Firstly, go to the MongoDB website  and navigate to the Download Center. Download the correct version and run the installer. For ease of access, customise the location to be on the C drive root. In the command line, go to the bin within the mongodb folder. Return the below in order to set up the directory and logging. After hitting enter, the following will be displayed. The MongoDB service is now started and we can go ahead and view and customise some no-SQL databases. Returning "show dbs" in the command line will display the current databases. We can see we have a local and admin database. To create a new database, for example "mycustomers" we have to return "use mycustomers". If the "mycustomers" database already existed, then the "use mycustomers" command would not create a new database, but instead make "mycustomers" the active database. ...

Storing passwords securely

This post examines how a user password can be securely stored. There are many blog posts elsewhere online that detail the importance behind securing passwords securely; this post will simply focus on the code which can accomplish the task. The extracts below are from a simple console application that demonstrates the method used to securely save and verify a user password. In the Main  method, firstly the user is prompted to enter their password which is immediately passed into the HashNewPassword  method which itself salts and hashes the password and assigns it to the variable hashedPassword . In the HashNewPassword  method, the salt  variable is declared as an array of bytes. Using the RNGCryptoServiceProvider from  System.Security.Cryptography , a good standard salt is created. The salt, with the entered password, is then passed into the HashPassword  method. In the HashPassword  method, the hash  variable is declared...