Skip to content

Anekjain/E-Banking

Repository files navigation

E-BANKING

This is an E-banking Webiste which performs basic tranasactions. Technologies Used : JSP, HTML, CSS, Bootstrap, JS, Servlets, MYSQL.

GOAL:

E-Banking Application is nothing new but my main focus was to enhance the Security of the Web Application.

So What I Did ? & How it enhances Security.

I Used SHA - 256 One Way Hashing Algorithm which was good hands on experience. It enhances the security by protecting the Database Hijacks. This is One Way Hashing Algorithm which is now standard algorithm used in real life world.

Now My Second focus was to use SQL Parameters to prevent an SQL INJECTION ATTACK on DATABASE.

SHA-256 Implementation

import java.math.BigInteger; 
import java.nio.charset.StandardCharsets; 
import java.security.MessageDigest; 
import java.security.NoSuchAlgorithmException; 

// Java program to calculate SHA hash value 

class GFG { 
	public static byte[] getSHA(String input) throws NoSuchAlgorithmException 
	{ 
		// Static getInstance method is called with hashing SHA 
		MessageDigest md = MessageDigest.getInstance("SHA-256"); 

		// digest() method called 
		// to calculate message digest of an input 
		// and return array of byte 
		return md.digest(input.getBytes(StandardCharsets.UTF_8)); 
	} 
	
	public static String toHexString(byte[] hash) 
	{ 
		// Convert byte array into signum representation 
		BigInteger number = new BigInteger(1, hash); 

		// Convert message digest into hex value 
		StringBuilder hexString = new StringBuilder(number.toString(16)); 

		// Pad with leading zeros 
		while (hexString.length() < 32) 
		{ 
			hexString.insert(0, '0'); 
		} 

		return hexString.toString(); 
	} 

	// Driver code 
	public static void main(String args[]) 
	{ 
		try
		{ 
			System.out.println("HashCode Generated by SHA-256 for:"); 

			String s1 = "Welcome to Cryptography"; 
			System.out.println("\n" + s1 + " : " + toHexString(getSHA(s1))); 

			String s2 = "hello world"; 
			System.out.println("\n" + s2 + " : " + toHexString(getSHA(s2))); 
		} 
		// For specifying wrong message digest algorithms 
		catch (NoSuchAlgorithmException e) { 
			System.out.println("Exception thrown for incorrect algorithm: " + e); 
		} 
	} 
} 

This is How SQL Injection Works.

SQL INJECTION

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published