RSA
Algorithm
RSA stangs for Rivest
Shamir Adleman named after Ron Rivest, Adi Shamir and Len Adleman who invented it in 1977. RSA is
an asymmetric cryptographic algorithm used by modern computers to encrypt and
decrypt messages. Asymmetric means that there are two different keys: one is public key and the other is private key. This is also called public key cryptography, because one of them can be given to everyone. The other key
must be kept private.
The RSA cryptosystem
is the most widely used public key cryptography
algorithm in the world. It can be used to encrypt a message without the need to exchange a secret key separately. For example,
Party A can send an encrypted message to party B without any prior exchange of
secret keys. A just uses B's public key to encrypt the message and B decrypts it using the private key, which only he
knows. RSA can also be used to sign a message, so A can sign a message using their private key and B can verify it using A's
public key.
From data security
perspective, our encrypted data is secured till our private key is secured.
A practical key generation
approach:
1. Generate two large
random primes, p and q, of approximately equal size.
2. Compute n = pq and
(phi) φ = (p-1) (q-1).
3. Choose an integer e,
1 < e < phi, such that gcd(e, phi) = 1(e should be co-prime with phi).
4. Compute the secret
exponent d, 1 < d < phi, such that
d * e mod phi=1
This is the most
crucial step of the process. Basically, we can solve this in two ways:
By reorganizing above
equation,
d = mod inverse
(e, phi)
By using Extended Euclidean
Algorithm.
Keep all the values
d, p, q and phi secret except e which is public key.
Finally,
Public key = (n, e)
Private key = (n, d)
For encryption, C =Pe mod n
For decryption, D =Cd mod
n
where P is the text to be encrypted
C is the encrypted text which we can utilize
for our purpose.
D is the decrypted text.
e.g.
A very simple example of RSA
encryption is
1. Select primes p=11, q=3.
2. n = pq = 11*3 = 33
phi = (p-1)(q-1)= 10*2 = 20
3. Choose e=3
Check gcd (e, phi) = gcd(3, 20) = 1 (i.e. 3 and 20 have no common factors )
4. Compute d such that d * e mod phi=1.
In our case, d is 7.
5. Public key = (n, e) = (33, 3)
Private key = (n, d) = (33, 7).
Now say we want to encrypt the
message P = 7,
C = Pe mod n = 73 mod 33 = 343
mod 33 = 13.
Hence the ciphertext C = 13.
To check decryption we compute
D = Cd mod n = 137 mod 33 = 7.
A simple implementation of RSA
Algorithm in Java is given below:
import
java.io.*;
import
java.util.Random;
import
java.math.BigInteger;
public
class myRSA1
{
int primegen() //generates prime numbers
{
int i,j,num,size=1000,index=0,c,r,r1;
Random
ran = new Random();
int
arr []=new int[size];
r1=ran.nextInt(2000);
for(i=100;i<r1;i++)
{
num=i;
c=0;
for(j=2;j<=num/2;j++)
{
if(num%j==0)
c++;
}
if(c==0)
arr[index++]=num;
}
r=
ran.nextInt(index); //returns a random
prime number
return
arr[r];
}
long
gcd(long a, long b) //calculates
greatest common divisor
{
long t;
while(b != 0)
{
t = a;
a = b;
b = t%b;
}
return a;
}
long
cale(long b) //calculates and returns e
{
long
a,g;
Random
ran = new Random();
do
{
a=
ran.nextInt((int)b/2);
g=
gcd(a,b);
}
while(g!=1);
return
a;
}
long
solve(long phi, long e) //extended Eucledian Algorithm to find d
{
long x1= 1, y1= 0, x2 = 0, y2 = 1,
d1=phi,d2=e,k;
long lastx,lasty,lastd;
do
{
k = d1/ d2;
lastx=x1-(x2*k);
lasty=y1-(y2*k);
lastd=d1-(d2*k);
x1=x2;
x2=lastx;
y1=y2;
y2=lasty;
d1=d2;
d2=lastd;
}
while (lastd!= 1);
return lasty;
}
BigInteger[]
encrypt(String str,long e,long n)
//Encrypts String
{
int
i,l,ch;
char
c;
BigInteger
charpow,t1,t2,t3;
l=str.length();
BigInteger
arr[]=new BigInteger[l];
t2=BigInteger.valueOf(e); //converting long to BigInteger
t3=BigInteger.valueOf(n);
for(i=0;i<l;i++)
{
c=str.charAt(i);
ch=(int)c;
t1=BigInteger.valueOf(ch); //Converting Biginteger to integer
charpow=t1.modPow(t2,t3);
arr[i]=charpow;
}
System.out.println("Encrypted
string");
for(i=0;i<l;i++)
System.out.print(arr[i]);
System.out.println("");
return
arr;
}
void
decrypt(BigInteger arr[],long d,long n)
//Decrypts String
{
int
l=arr.length,i;
char
ch;
BigInteger
res,res1,t2,t1;
String
str="";
t1=BigInteger.valueOf(d);
t2=BigInteger.valueOf(n);
for(i=0;i<l;i++)
{
res=arr[i];
res1=res.modPow(t1,t2);
ch=(char)(res1.intValue()); //Converting Biginteger to integer
str=str+ch;
}
System.out.println("Decrypted
string="+str);
}
public
static void main (String[] args) throws IOException
{
long
p,q,initd,d,e, n,phi;
String
s;
myRSA1
rsa = new myRSA1();
BufferedReader
br=new BufferedReader(new InputStreamReader(System.in));
p=rsa.primegen();
q=rsa.primegen();
n=p*q;
phi=(p-1)*(q-1);
e=rsa.cale(phi);
initd=rsa.solve(phi,e);
if(initd>phi)
d=initd%phi;
else
d=initd+phi;
System.out.println("Enter
string");
s=br.readLine();
BigInteger
ans[]=rsa.encrypt(s,e,n);
rsa.decrypt(ans,d,n);
}
}
Above program uses Random class and Biginteger class for prime number generation and calculation of
various other values. After calculation of all values, we convert the
characters of string to be encrypted to their corresponding ASCII value and then
encrypt them.
The strength of RSA algorithm
lies in the size of prime numbers.
For fast execution, we took very
small digits, One can increase their size and encrypt the text as per their
needs. Any question or query regarding program or algorithm can be asked in
comment section. Suggestions or improvements are welcomed.
The WannaCry ransomware attack is an ongoing worldwide cyberattack by the WannaCry ransomware cryptoworm, which targets computers running the Microsoft Windows operating system by encrypting data and demanding ransom payments in the Bitcoin cryptocurrency.
Date | 12 May 2017 – present |
---|---|
Location | Worldwide |
Also known as | WannaCrypt WanaCrypt0r Wana Decrypt0r 2.0 WCRY WNCRY |
Type | Cyberattack |
Theme | Ransomware encrypting files with $300 – $600 demand (via bitcoin) |
Cause |
|
Outcome | Over 200,000 victims and more than 230,000 computers infected |
The attack started on Friday, 12 May 2017, and has been described as unprecedented in scale, infecting more than 230,000 computers in over 150 countries. Parts of Britain's National Health Service (NHS), Spain's Telefónica, FedEx and Deutsche Bahn were hit, along with many other countries and companies worldwide.
WannaCry spreads across local networks and the Internet to systems that have not been updated with recent security updates, to directly infect any exposed systems. To do so it uses the EternalBlue exploit developed by the U.S. National Security Agency (NSA), which was released by The Shadow Brokers two months before. A "critical" patch had been issued by Microsoft on 14 March 2017 to remove the underlying vulnerability for supported systems, nearly two months before the attack, but many organizations had not yet applied it. Those still running exposed older, unsupported operating systems such as Windows XP and Windows Server 2003, were initially at particular risk but the day after the outbreak Microsoft took the unusual step of releasing updates for these operating systems too. Almost all victims are running newer Windows 7.
Shortly after the attack began, a web security researcher who blogs as "MalwareTech" discovered an effective kill switch by registering a domain name he found in the code of the ransomware. This greatly slowed the spread of the infection, but new versions have since been detected that lack the kill switch. As per official news agencies reports, the cyber attack has slowed down drastically and has died down as of 19 May 2017.
Scree shot From Victim after attcked by WannaCry Ransomeware Virus
Attacker attacks System with wannacry virus and excrypts all its Data into un recongnizable format . and That encrypted form of data gets of no use .
And it can make a big loss to various Companies goverment Organizations .
When Data gets successfully encrypted by Wannacry virus . Then a pop Window appears which is linked above in the Document . In which all the information is displayed about what happent to my data . and method of Recovering my Data. Then there is a payment page which asks a payment of
300$ in form of Bitcoins .
and after the payment Data automatically gets decrypted .
This is the whole process of WannaCry ransomeware Attack .
|
Justin Bieber India Concert Live Updates: Justin Bieber, Everybody. 'What A Beautiful Night'
Singer Justin Bieber has sent his trusted 'Beliebers' into a frenzy opening his debut gig in Mumbai as scheduled. The air his heavy with Bieber-Fever at Mumbai's DY Patil stadium. Meanwhile, Bollywood stars like Alia Bhatt, Arjun Rampal, Sonali Bendre and Arbaaz Khan are in the audience. Here are the latest pictures, videos and updates about Justin Bieber's concert in India.
Live Updates Of Justin Bieber's India Concert From DY Patil Stadium, Mumbai
International pop icon Justin Bieber landed by a chartered flight in Mumbai at around 1:30 am at Kalina airport. He was received by actor Salman Khan's bodyguard Shera, who is in charge of the singer's security arrangements. The 23-year-old singer was dressed in a pink hoodie and shorts, as he made his way out of the airport surrounded by fans. Justin Bieber will perform at Mumbai's DY Patil Stadium tonight. This is Justin Bieber's first concert in India. He is on a tour for his album Purpose. Justin Bieber is staying at a hotel in Lower Parel and will tour Mumbai in Rolls Royce vehicle. The concert opens at 4 pm while the entry begins in the afternoon. However, an excited Beliebers (as Justin Bieber's fans call themselves), have already gathered around the venue.
Justin Bieber will enthral the audience with his hit tracks like Baby, Boyfriend, What Do You Mean?, Get Used to It, Company and No Pressure. Also, he is expected to play a solo drum set. Wow, excited much?
Alan Walker, DJ Zaeden and Sartek will perform the opening act. Justin Bieber's performance will begin from 8 pm, which will extend for about 90 minutes. He is supported by a group of 25 dancers. All Justin Bieber's fans, take note. You can join the pop icon onstage, if you are lucky. A special JB Pit is being created to accommodate 350 special fans, who can watch him perform closely.
Don't miss Justin Bieber's grand entry. The singer will arrive at the venue by a chopper. Ahead of the concert, Justin Bieber, who was in Dubai a couple of days ago, tweeted, "Dubai is incredible... India you are next. Ready?" Well, we assume the singer must have got a reply seeing the fans outside the airport and the concert venue.
Justin Bieber will enthral the audience with his hit tracks like Baby, Boyfriend, What Do You Mean?, Get Used to It, Company and No Pressure. Also, he is expected to play a solo drum set. Wow, excited much?
Alan Walker, DJ Zaeden and Sartek will perform the opening act. Justin Bieber's performance will begin from 8 pm, which will extend for about 90 minutes. He is supported by a group of 25 dancers. All Justin Bieber's fans, take note. You can join the pop icon onstage, if you are lucky. A special JB Pit is being created to accommodate 350 special fans, who can watch him perform closely.
Don't miss Justin Bieber's grand entry. The singer will arrive at the venue by a chopper. Ahead of the concert, Justin Bieber, who was in Dubai a couple of days ago, tweeted, "Dubai is incredible... India you are next. Ready?" Well, we assume the singer must have got a reply seeing the fans outside the airport and the concert venue.
Nowadays mobiles with high specifications such gigs of RAM, massive batteries, mammoth processors, and enormous display are available in market. There are flagship mobiles which provide 6GB of RAM but purchasing them means burning a hole in your pocket. Also what of those earlier/older models or lower-end mobiles which provide moderate amount of RAM. In that also only 50%-70% RAM (approx.) can be utilized by user, rest is usually deployed by operating system and various other processes.Requirements:There are various application and games such as Asphalt 8, Mortal Combat which demands plenty of RAM. Today we are going to share a method by which you can increase RAM of your mobile using a SD card. This tutorial is helpful only if your Android mobile is rooted (how to root a mobile link).
1) Android Mobile (rooted)
2) SD Card Reader
3) SD Card (size =2- 4 GB) (Class 4 or higher)
4) A Computer System
Before proceeding below, take backup of your SD card. It is important as we will be formatting it in further steps.
Simply follow the below steps:
Step 1.
First of all download and install "Mini Tool Partition" for Windows on your pc. Then connect your SD card to pc.
Step 3.
After step 2 completes, again right click on your SD card and select "Create" option. If you SD card is less than 4GB then select "FAT" else select "FAT32".
Step4.
Then adjust "Size and location " option leaving only 1000MB unallocated space (unallocated space will be equal to RAM we are going to add) and then select OK.
Step 5.
Now we have 1000MB unallocated space on our SD card. We are going to allocate this space to use it as RAM. Right click on your SD card, select "Create" option then select primary. Now here select "Ext2" not "FAT32" from the drop down list and do not leave any unallocated space this time. Click OK.
Step 6.
Click "Apply" on the left corner.
After completing above steps, disconnect your SD card from pc and insert it into the microSD slot of your android mobile.
Now,
Step 1.
Download and install “Link2sd” from Google Play Store on your Android mobile.
Step 2.
Open the “Link2sd” application and rooted device will ask for permission. Select "Grant Permission". After that app will ask you file system for you SD card, here select "Ext2". Click on “Ok”.
If you have any query plz comment below and let us know. We will be happy to solve it.
And yeah thanks us later....
Subscribe to:
Posts (Atom)