Java

Professional Java Security : Symmetric Encryption Part 1

Professional Java Security : Symmetric Encryption Part 1

Fadıl

Symmetric Encryption

This chapter we’re going to elaborate on the subject by describing how to use the JCE to perform symmetric encryption. To begin with, we will look at how we encrypt and decrypt using symmetric encryption. Then we discuss applications for symmetric encryption, followed by some examples, which deal with the following aspects of encryption:

Basic encryption
Encryption using Blowfish
Password-based encryption
The main topics discussed in this chapter are:

Java Tutorials:The for loop

Java Tutorials:The for loop

Fadıl

The for loop

This loop is used if you know exactly how many times you want to perform a certain task. For example to print out the 2 times table you know you want to loop 10 times. The code to print out the 2 times table is listed below. It uses a for loop. Pay special attention to how the loop structure is set up.

public class TimesTable {

public static void main(String [] args) {

for(int i = 1; i<11; i++)
{
System.out.println(i + “ times 2 is “ + (i*2));

}
}
}

Compile the above code and see what happens. This code shouldn’t pose you too many problems. The first line needs some explaining. The first part of the line in brackets sets up what is called the reference variable (always an integer), the second part is what is known as the break condition (if this condition isn’t met the loop is terminated) and the last part declares how the variable is to change after each cycle of the loop (in this case when the loop gets to the bottom 1 is added to the value of i).

Java Tutorials: If Statements

Java Tutorials: If Statements

Fadıl

In this tutorial I will discuss if statements and how they can be used to implement decision making in your programs.

First of all lets have a look at an example of an if statement. This will show you the syntax in Java.

if (age >= 18)
{
System.out.println("You are an adult"); 
}
else
{
System.out.println("You are a minor");
}

Just by looking at the code listed above it should be pretty obvious as to what the code does. It checks the value of the variable called age, if this is greater than or equal to 18 it prints “You are an adult”, and if it is less than 18 “You are a minor” will be printed.

Java Tutorial:  Variables and Comments

Java Tutorial: Variables and Comments

Fadıl

To an experienced coder these two topics probably don’t seem to have much in common, the reason I am going over them in this tutorial is that they are both important concepts that I didn’t want to write 2 seperate tutorials for.

Variables

Ok. Now your computer stores data as different data types for example it sees the number value 3 in a completely different way to the sentence “Hello World”. So what is a variable. A variable is a place in your computer where you can store information. Pretty easy so far huh? Well now comes the important part: Each data type has a variable type associated with it. The most relevant are listed below.

HelloWorld.java

HelloWorld.java

Fadıl

Introduction

Welcome to the first of my introduction to Java tutorials. These tutorials are aimed at complete beginners to programming. Java is a good language to start with because its syntax is very similar to the more powerful c++ and it has been designed in a very object oriented way. Object oriented programming (or OOP for short) is a way of programming that breaks the problem down into parts. These parts then slot together to form the solution.