Monday, October 22, 2018

RSA Algorithm in C programming language


This is a code for RSA in C programming language.



RSA:-
Source code:-

#include<stdio.h>
#include<math.h>
int gcd(int a, int h)
{
    int temp;
    while(1)
    {
        temp = a%h;
        if(temp==0)
        return h;
        a = h;
        h = temp;
    }
}

int main()
{
    //2 random prime numbers
    double p = 3;
    double q = 7;
    double n=p*q;
    double count;
    double totient = (p-1)*(q-1);
    double e=2;
    while(e<totient){
    count = gcd(e,totient);
    if(count==1)
        break;
    else
        e++;
    }
    double d;
    double k = 2;
    d = (1 + (k*totient))/e;
    double msg = 12;
    double c = pow(msg,e);
    double m = pow(c,d);
    c=fmod(c,n);
    m=fmod(m,n);

    printf("Message data = %lf",msg);
    printf("\np = %lf",p);
    printf("\nq = %lf",q);
    printf("\nn = pq = %lf",n);
    printf("\ntotient = %lf",totient);
    printf("\ne = %lf",e);
    printf("\nd = %lf",d);
    printf("\nEncrypted data = %lf",c);
    printf("\nOriginal Message Sent = %lf",m);

    return 0;
}

Output:-


ASCII code for String using C programming language


This is a code for ASCII code for String using C programming language.



ASCII :-
Source code:-

#include<stdio.h>
#include<conio.h>
int main()
{
char arr[100];
long a=0,b=0,c;
long int s=0;
int i,n=5,j;
long dummy,remainder=0,binary=0,base=1;
long binaryval,hexadecimalval=0,k=1,rm;

printf("Enter the string : ");
for(i=0;i<n;i++)
{
scanf("%c",&arr[i]);
}
printf("ASCII code for string : ");
for(i=0;i<n;i++)
{
printf("%d ",arr[i]);
}
printf("\n");
for(i=0;i<n;i++)
{       remainder=0,binary=0,base=1;
dummy=arr[i];
while(dummy>0)
{
remainder=dummy%2;
binary=binary+remainder*base;
dummy=dummy/2;
base=base*10;
}
printf("\n 8 Bit code for %c(%d) is 0%ld",arr[i],arr[i],binary);
a=0,b=0;
a=binary;
b=a/10000;
printf("\n Left half : %ld",b);
s=0;
for(j=1;j<=4;j++)
{
s=a%10000;
}
printf("\tRight half : %.4ld",s);
hexadecimalval=0,k=1;
binaryval=s*10000+b;
printf("\n after swap : %.8ld",binaryval);
while(binaryval!=0)
{
rm=binaryval%10;
hexadecimalval=hexadecimalval+rm*k;
k=k*2;
binaryval=binaryval/10;
}
printf("\n Equivalent hexadecimal value :  %ld",hexadecimalval);
}
getch();
}

Output:-

Caesar cipher encryption and decryption using C programming language


This is a code for Caesar cipher encryption and decryption using C programming language.



Caesar cipher encryption:-
Source code:-

#include<conio.h>
#include<stdio.h>
int main()
{
int key,i;
char msg[100],ch;
printf("enter string to be encrypt");
scanf("%s",&msg);
printf("enter key");
scanf("%d",&key);
for(i=0;msg[i]!='\0';i++)
{
ch=msg[i];
if(ch>='a'&&ch<='z')
{
ch=ch+key;
if(ch>'z')
{
ch=ch-'z'+'a'-1;

}
msg[i]=ch;

}
else if (ch>='A'&&ch<'Z'){
ch=ch+key;
if(ch>'Z')
{
ch=ch-'Z'+'A'-1;
}
msg[i]=ch;
}
}
printf("encrypted msg:%s",msg);
return 0;
}


Output:-


                                                                                                            

Caesar cipher decryption:-
Source code :-

#include<conio.h>
#include<stdio.h>
int main()
{
int key,i;
char msg[100],ch;
printf("enter string to be encrypt");
scanf("%s",&msg);
printf("enter key");
scanf("%d",&key);
for(i=0;msg[i]!='\0';i++)
{
ch=msg[i];
if(ch>='a'&&ch<='z')
{
ch=ch-key;
if(ch>'z')
{
ch=ch-'z'+'a'-1;

}
msg[i]=ch;

}
else if (ch>='A'&&ch<'Z')
{
ch=ch-key;
if(ch>'Z')
{
ch=ch-'Z'+'A'-1;
}
msg[i]=ch;
}
}
printf("encrypted msg:%s",msg);
return 0;
}

Output:-


Short Over View of BlockChain

Real Estate
Introduction

A blockchain, originally block chain, is a growing list of records, called blocks, which are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. By design, a blockchain is resistant to modification of the data.


Decentralized Peers

Rather than the centralized “Hub and Spoke” type of network, Blockchain is a decentralized peer to peer network. Where each NODE has a copy of the ledger.


Legacy Network  Blockchain Network


Centralized DB  Distributed Ledgers



How Blockchain Technology Works




Blockchain - Social Networking

Blockchain in social networking


Introduction to Blockchain Technology
Blockchain is normally associated with Bitcoin and other cryptocurrencies, but it is efficiently a database that’s authenticated by a wider community, rather than a middle authority. It’s a collection of records that a crowd oversees and maintains, rather than relying on a single entity, which most expected hosts data on a particular server. Of course, a physical database kept on paper could never be supervised by tens of thousands of peers. That’s where computers, and the internet, come in. Each “block” stands for a number of transactional records, and the “chain” component links them all together with a hash function. As records are shaped, they are established by a distributed network of computers and paired up with the preceding entry in the chain, thereby generating a chain of blocks or a Blockchain.
Blockchain Risks and Opportunities
Opportunities:
The potential opportunities of blockchain technology will be examined in this article under three broad categories as follows:

1. Commerce
The first recognizable niche that comes to mind when the blockchain is mentioned is commerce. The first ever successful implementation of the blockchain framework resulted in Bitcoin, a payment processing architecture. This, and the fact that the majority of the blockchain applications that have been launched since then have been focused on cryptocurrencies has led some to believe that crypto is all there is to blockchains.

The entire framework of global commerce presents a veritable opportunity for blockchain implementation. Blockchain technology can be applied to almost every aspect of commerce. One of the most valuable opportunity for blockchain adoption in commerce is the area of cross-border transactions. The current framework for cross-border transactions is one that involves a number of processes and checks that slow down the transactions and even make them quite expensive. Blockchain technology has the potential to create a borderless network architecture that will enable cross-border transactions to happen almost instantaneously.
2. Government
Government is charged with a whole host of duties and responsibilities that must be discharged for the benefit of the citizens. Blockchain technology has a vital role to play in government especially in the context of the 21st-century world. Blockchains can be utilized for identity management systems, document processing, safeguarding financial and state services, as well as transmitting sensitive information just to mention a few.
Risks:
The blockchain risks can be broadly classified under three categories:
Standard risks:
Blockchain technologies expose institutions to risks that are similar to those associated with current business processes but introduce nuances for which entities need to account.

Value transfer risks:
Blockchain enables peer-to-peer transfer of value without the need for a central intermediary. The value transferred could be assets, identity, or information. This new business model exposes the interacting parties to new risks that were previously managed by central intermediaries.
Smart contract risks:
Smart contracts can potentially encode complex business, financial, and legal arrangements on the blockchain, and could result in the risk associated with the one-to-one mapping of these arrangements from the physical to the digital framework.
Key challenges
One of the challenges of blockchain is in its very nature: the distributed ledger. Because every endpoint has to have a copy of the entire blockchain, and that blockchain is constantly growing as more things are added, the system gets slower, taking up more space. If the same sort of system was implemented under a medical records system, you can see where it would become untenable very quickly.
The biggest challenge of blockchain is the lack of awareness of the technology, and the lack of understanding how it works.
Case study
Blockchain in social networking:
Whether you are a social media marketer the one who is offering services to businesses or a business owner who is making use of social media to reach customers, it is quite important that you understand that social media is about to go through a striking shift.
The blockchain is unsettling a number of industries, and social media is among those which is likely to feel the ramifications of blockchain disruption first. Companies actually used to create their brands on platforms like Facebook and Twitter are about to realize that all that investment of time may have been for nought. As it is going to change the platforms consumers and businesses use and how they network, social media marketing will go through a disturbance which they never expected and even it never did before.

Problems Identified
1. Control over data
Social network users currently have no control over their data. Once a user has an account on a social network it is as if they relinquish their right to their personal information and control over content. Total control is in the hands of social network owners who dictate what is to be viewed by users and what is not. And with such control, the social network platform owners are able to profit from their users without the users’ consent.
2. Privacy
If the recent Facebook data breach is anything to go by, then the current social networks are proving to have poor security. Users are susceptible to attacks which are known to expose their personal information.
3. Single Point of Failure
Because of their centralized nature, conventional social networks are vulnerable to attacks that often lead to costly losses. Hackers only have one point of attack, which ones breached they can get access to a flood of users’ information. For example, in 2012 a hacker broke into LinkedIn network and got away with some 6.5 million encrypted passwords and posted them on a Russian hacker forum. Four years later another hacker who goes by the name Peace was selling more of LinkedIn hacked user information. He claimed that the total count of data stolen from LinkedIn reached 167 million and not 6.5 million as thought before. Of which 117 million had both email and encrypted passwords.

Solutions Provided
Blockchain technology is the long-awaited cure to issues affecting the current breed of social networks. The following features are what make Blockchain technology so groundbreaking.
1. Transparency
Blockchain distributed nature eliminates the control of platforms by a single entity. And since every transaction on the Blockchain-based platform is tracked and audited by several servers and developers, it becomes impossible for anyone to tamper with the data.
2. Control over data
By eliminating intermediaries, users on decentralized social networks will own and control their data. Blockchain technology ensures that whatever you post on the social network can be traced anywhere it goes and never be duplicated. And the best part is that if you delete it, it is deleted in the whole system and no unauthorized third parties can access and benefit from it.


3. Relevant content
Once control of your social network platforms is in your hands, you get to dictate the type of content you would like to see. Therefore you don’t get unwanted advertisements on your platforms that only benefit the advertisers and not you.

4. Earning from social media activity
Blockchain-based platforms enable you and your viewers, listeners, readers, depending on the content you create, to build a direct relationship that is monetarily beneficial to you.

Market Competition
As we are entering an era of change, a global phenomenon will soon emerge as philosophies and beliefs shift and unexposed cultures experience new technologies. In 20-30 years from now we are going to enter into a super economy, where the content is much more equally distributed between the global populations.

Right now the margins of distribution are narrow, and this is about to change. This is disruptive change that can happen overnight. People will be able to buy essential products, solar panels, mobile phones, etc. This could change markets on a global scale as disadvantaged populations can more easily communicate.

Kodak was liquidated overnight when Nokia chose to ship their mobile phones with cameras. The same could happen with social media and the banking system. This could herald a sea change in global economics. Only one single form of social media has to accommodate micro-payments in order for this to happen. Once they integrate with the Blockchain, then boom! Something big is happening. From there it will spread like wildfire. There will be a big change in the landscape of social media companies. The first to leap will gain the most traction, then the others must also conform or die. Social media companies will have no justification to exist if they do not get onboard.

The next question is what will happen to all the advertisers on social media? Revenues of companies that make money from advertisements (Google, Yahoo, Facebook, etc.) will go down. There would be less justification to charge your user base money for advertisements. Major businesses may be rendered obsolete – this will be the next disruption of the chain. Social media products may no longer be a necessary advertising platform. Existing companies will try to ensure they are not outgrown when equivalent open source platforms rise quickly and establish firm footings in fresh soil.

Future Trends
1) More earning
The combination of social networks and cryptocurrencies enabled with blockchain development is another tempting example of the future of social platforms. When decentralized platforms become common, users of social networks will have the option of choosing the platforms on which to establish a network.
              The ability to earn small amounts of cryptocurrencies for their activities will attract users to platforms where contributions to platform growth are rewarded. Think about how much time you spend currently on social networking sites like Twitter and Facebook and imagine if each publication you won earned you a small amount of Bitcoin. A future of social networks enabled for encryption is really intriguing.
2) No more spams
Smart contracts and blockchain development technology will also influence the dissemination of false content. The current social media networks are flooded with everything from false news to spam bots. In the social media networks of the future, the distribution of content will be based on verified information and the propagation of traceable data. The ability to block content and its collaborators is a tempting option for brand creators.

3) No fraudulent impressions
There will be a growing interest in identities verified online. With massive bot issues on social media platforms such as Facebook and Twitter, business owners are increasingly looking for reaching reliable platforms for their customers where they can increase their marketing ROI.

BlockChain Technology – REAL ESTATE


BlockChain Technology – REAL ESTATE

Introduction  
In the recent years, there has been an increasing interest in the Blockchain tech- nology. The Blockchain is a novel disruptive technology based on cryptography. It has been known of the work of Nakamoto [1] in 2008 who showed how this technology can become the core component to support transactions of the digi- tal currency (bitcoin) [2]. With the introduction of Blockchain, many fields such as  finance,  accounting,  and  real  estate  will  receive  a  positive  impact  using  the benefits of this technology. One area in which blockchain technology could play a vital role is real estate and smart cities. Globally, real estate is undergoing a major evolution and transformation to- wards smart cities. Smart cities are being developed and a plethora of network, services, and transactions are integrated into the city planning initially and daily use. It is anticipated that the evolution of technology, not only improves life, for example for tenants or office workers, but also enhances building performance and sustainable energy. 


Blockchain—Risks and Opportunities  

 In a traditional real estate sale, all financial transactions are dealt with at closing. An online auction has fixed costs, making it potentially more expensive than a traditional transaction using a real estate agent. And the fees will apply whether the property is sold or not.  The pre-auction phase can lead to an unexpected rush of people curious about the property. A seller is contractually obligated to allow any interested party to view the premises and to make the property accessible to any surveyor who wants to value it for a client. This can turn into heavy traffic in the weeks before the auction.  Any online monetary transaction comes with risk. Even the most secure online marketplace is prone to the types of fraud that run rampant on the Internet. A buyer can win a bid, pay and find himself on the bad end of a phony sale. It’s not unusual for those with ill intent to use these venues to grab some big property sales and then disappear.  A lot of sellers don’t take note of the timeline they have to get off the property once the sale is complete. It can be as little as 28 days after the auction. This doesn’t leave much time for relocation.  A property’s value is determined by the market, and a seller can decide the minimum price on the property. With an auction, the property’s value is based on the highest offer—if you find a buyer at all—and the seller is stuck with that price. A reserve price can be set, but that only minimizes financial risk, not eliminate it. The only way to ensure maximized value for any property is through a traditional real estate transaction. 
  

Case study  

In this report, we focus on the disruption that every industry in today’s digital economy is facing today due to the emergence of blockchain technology. Blockchain technology has potential to become the new engine of growth in digital economy where we are increasingly using Internet to conduct digital commerce and share our personal data and life events. 

There are tremendous opportunities in this space and the revolution in this space has just begun. In this report we focus on few key applications of Blockchain technology in the area of Notary, Insurance, private securities and few other interesting non-financial applications. We begin by first describing some history and the technology itself. 

How does it work? 

We explain the concept of the blockchain by explaining how Bitcoin works since it is intrinsically linked to the Bitcoin. However, the blockchain technology is applicable to any digital asset transaction exchanged online.  


Problems Identified  

Most developers, until recently have been using the offline medium for marketing. Developing from a large offline presence to online lead generation has its implications. Most real estate Developers do not know where to start the digital journey. Transitioning from generating sales via the traditional methods of cold calling to intensive integrated marketing campaigns, The Biggest Challenge Real Estate Developers’ Face In Mumbai is determining what Digital Business Strategy guarantees a boost in high ROI? 
Another key challenge faced by many property developers is the fact that amid the fast-paced digital shift, how does one choose the right digital channels or Online Advertising Strategy to drive toward the best quality lead that contributes to increasing their sales? The real estate industry is forming a shift in the space and like every other competitor most real estate players do not clearly define the boundaries of what makes a good marketing strategy. 
  


Solutions Provided  

In digital marketing, Real Estate in Digital Marketing terms means lead generation and this means implementing The Latest Digital Marketing Trends to capture that valuable lead that matters to your business. Effectively understanding which platform works to drive those very valuable leads is a strategic process which requires deep in-depth knowledge of gaining higher conversion rates that in turn Add Higher ROI To Your Business. This can vary right from understanding the campaigns to the various targeting options to driving the right audiences through a filtered lens to quantify which lead will ultimately have a higher impact to convertibility. 
This is exactly what we do for our real estate clients: The Results What did we do that was different? 
 Optimized Landing Pages 
Yes, you heard that right! In Real Estate, Having An Effective Landing Page Is The Key that opens the door to a variety of potential leads. Having a static landing page that captures the basic information like name, number and Email isn’t enough. Driving the leads to a call to action ensures that you grab their attention and ensure that the purpose of running all your ad campaigns is put to maximum use by getting them onto your landing page. The landing page has to be highly optimized to ensure: 
  1. The landing page visitor is kept captivated by only key product information 
  2. The landing page specifies the project details and invokes curiosity to find out more details 
  3. There is no escape other than filling out the form so the chances of the lead bouncing off your page is minimal. 


After all, optimizing the landing page is the only way to determine how those higher but better quality leads are driven! 




 Market Competition  

Real estate professionals are changing the way they do business: offering potential buyers the chance to view detailed property listings online, using websites to gather leads on potential customers, and using the Internet to match buyers and sellers. Some are changing the “menu” of services they're offering. More and more, consumers can choose among real estate professionals who do business on a “fee per service” basis and others who provide the 
full complement of services. Because buying a home is the single most important purchase many consumers will make, the Federal Trade Commission has enforced antitrust rules in the real estate business to make sure that increased competition continues to lead to more choices, better prices and stepped-up services for buyers and sellers. For instance, the Commission challenged a number of restrictive rules adopted by Multiple Listing Services (MLS) 
to keep low-cost and discount brokers off MLS listings and popular websites listing homes for sale. 


Future Trends 
Global megatrends will change the real estate landscape considerably over the next six years and beyond. While many of the trends are already evident, there is a natural tendency to underestimate how much the real estate world will have changed by 2020. 
The changing landscape will have major implications for real estate investment and development. It will increase the size of the asset pool, yet change the nature of investment opportunities. Real estate organizations will need to adapt early to survive and prosper. 

Diffie–Hellman key exchange using C programming language

This is a code for  Diffie–Hellman key exchange  using C programming language. Diffie–Hellman key exchange :- Source code:- #in...