Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa IoC encryption and decryption

Have Programming Question? Ask it here!
 
 
 


julius berzerlius
encryption and decryption
1 Answer(s)      3 years and a month ago
Posted in : IoC


ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should be in the corresponding ASCII format. And if it?s a word, concatenate a letter w to show that the word still continues. When a space is encountered, add a word space. Change word by word until the end of the message which is later stored in a file. This is called encryption. When one wants to read the contents of the file, It should display the encrypted form and also the original version. Changing the copy to the original will be called decrypting. Eg


Advertisement
View Answers

July 11, 2011 at 3:08 PM


#include <stdio.h>
#include <string.h>

#define MAX_LINE_LEN 256
#define MIN_PRINTABLE_ASCII 32
#define MAX_PRINTABLE_ASCII 126
#define NUM_PRINTABLE (MAX_PRINTABLE_ASCII - MIN_PRINTABLE_ASCII + 1)

typedef enum { false = 0, true } bool;
typedef unsigned char uchar;

void encode(uchar *,int);
void decode(uchar *,int);

int main(int argc, char *argv[]) {
    uchar line[MAX_LINE_LEN];
    int n;
    bool inputOk;

    for (inputOk = false; inputOk == false; ) {
        printf("Enter offset: ");
        fgets((char *)line,MAX_LINE_LEN,stdin);
        inputOk = (sscanf((char *)line,"%d",&n) == 1);
    }
    n %= NUM_PRINTABLE;
    printf("Enter line of text: ");
    fgets((char *)line,MAX_LINE_LEN,stdin);
    *strchr((char *)line,'\n') = '\0';
    encode(line,n);
    printf("\nEncoded: \"%s\"\n",line);
    decode(line,n);
    printf("Decoded: \"%s\"\n",line);

    return 0;
}

void encode(uchar *s,int x) {
    uchar *p = s;
    int z;

    while (*p != '\0') {
        z = (int)*p + x;
        if (z > MAX_PRINTABLE_ASCII) {
            z -= NUM_PRINTABLE;
        } else if (z < MIN_PRINTABLE_ASCII) {
            z += NUM_PRINTABLE;
        }
        *p++ = (uchar)z;
    }
}

void decode(uchar *s, int x) {
    encode(s,x *= -1);
}


Related Tutorials/Questions & Answers:
encryption and decryption
encryption and decryption  how to encrypt and decrypt data in text file
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
Advertisements
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
Encryption Decryption
Encryption Decryption  I want to store a type string to my database, specifically MSSQL, I want the stored data in the database to be encrypted and I want to retrieve it in it's decrypted format. I am using JSP's, I want
encryption and decryption of files
encryption and decryption of files   Please can any one provide me with the code for encryption and decryption of files using RSA algorithm. I want to use a browse option to search for the file which is needed for encryption
decryption and encryption - Java Beginners
decryption and encryption  hi everyone. my question is that i have one problem which i have to solve and the issue is that i have to do the encryption and decryption thing there in my code, e.g if the user enters the abc the code
servelt -jsp Encryption Decryption Code
servelt -jsp Encryption Decryption Code  Encryption code&Decryption code Iam developing a web security application for that reason i need a code of encryption &Decryption in servlet. Can u please send it to me.Its very
Encryption Decryption In Scriptlets/Java
Encryption Decryption In Scriptlets/Java  I have this code in my scriptlet, when I use the Encryption code to encrypt my data it executes... where the program stopped working and it stopped in the decryption part and I get
Encryption and Decryption - Java Beginners
Encryption and Decryption  Hello sir, i need Password encryption and decryption program using java program. I dont know how to write the program... the source code of encyption and decryption using java. Thanking you... 
encryption and decryption - Java Beginners
encryption and decryption  i need files encryption and decryption program using java. but i dont know how to write the program.pls help me thank you so much  Hi Friend, Try the following code: import java.io.
Password encryption and decryption
Password encryption and decryption  Hello, I'm developing a system that requires user to login to enter the system. so I wanted to store encrypted users' password in the database so that I wouldnt know their password
Sample code for An ASCII Encryption and Decryption code in C-language only.
Sample code for An ASCII Encryption and Decryption code in C-language only... code for this project including both the encryption and decryption aspects... stored in a file. This is called encryption. When one wants to read the contents
JSP Encryption - JSP-Servlet
JSP Encryption  Hi! Please give me code for MD5 encryption & decryption. Thanks in advance
sound encryption
sound encryption  i want to ask if there is a simple code to perform encryption on sound file
AES decryption in Java
AES decryption in Java   AES decryption in Java with password...-Decryption-using-key-password-.html    http://www.roseindia.net/answers/viewqa/Java-Beginners/26020-AES-Decryption-using-key-password-.html   
AES encryption in J2ME
AES encryption in J2ME  Is it possible to do aes encryption in j2me
What are encryption functions in PHP?
What are encryption functions in PHP?  What are encryption functions in PHP
password encryption in php - PHP
password encryption in php  example of password encryption in php
Encryption code - JSP-Servlet
Encryption code  Iam developing a web security application for that reason i need a code of encryption in servlet. Can u please send it to me.Its very urgent Because my project delivery date is very near
Encryption In Swing - Swing AWT
Encryption In Swing  Hi sir i have a JFrame Containing User Name and Password is there any way to encrypt password and how can we store the encrypted passwaord to MS ACCESS
AES Decryption using key password
AES Decryption using key password    /* Decrypt using AES with password */ /* developed by Nishanth Thomas - Insolutions Global Pvt Ltd Bangalore */ import java.security.spec.AlgorithmParameterSpec; import
Java Encryption using AES with key password
Java Encryption using AES with key password    /* AES alogrithm... This is my String"; // password for encryption final static String strPassword...); } }    /* AES encryption alogrithm in JAVA */ /* AES alogrithm
Open Source Encryption
Open Source Encryption Open Source encryption module loses FIPS... certification of the open-source encryption tool OpenSSL under the Federal Information... Layer encryption that can be used by browsers and other programs to securely
stegnography code
stegnography code  code for the digital stegnographic technique for the encryption and decryption of image
Cryptograpy
Cryptograpy  Write a separate java classes for encryption and decryption for already generated public and private keys ex:(PKCS8EncodedKeySpec; X509EncodedKeySpec
md5 in jsp
md5 in jsp  want code for encryption and decryption of password usind MD5 in jsp
Hi friends
Hi friends  How to create a guy based application for cryptography(encryption and decryption) with multiple algorithms like caesar, hash ..etc
Java - Security
Java  hello sir, I am trying to develop tools for encryption and decryption of pdf files using keys. i need some help in this regard.waiting for your reply thank you
J2ME code hint - MobileApplications
J2ME code hint  I am required to make a mobile application for encryption and decryption of sms messages using RSA. The last day for submission is 9th of March, 2009... If anyone can plz help me in this regard plz let me
What is WTLS?
What is WTLS?  hii, What is WTLS?   hello, Wireless Transport Layer Security protocal (WTLS) does all cryptography oriented features of WAP. WTLS handles encryption/decryption, user authentication and data integrity
GUI Interface .Reply me with in hour..Its Urgent - Java Beginners
project - contains , encryption & Decryption..what i have to do is...To create
JAva - Java Beginners
the problem in details : Answer 3 : For Security in java use encryption and decryption : Thanks
JAVA Cryptography
javax.crypto.spec.SecretKeySpec; /** * Basic symmetric encryption example */ public class..."); System.out.println("input text : " + Utils.toHex(input)); // encryption pass byte...: " + Utils.toHex(cipherText) + " bytes: " + ctLength); //decryption pass byte[] plainText
JAVA Cryptography
javax.crypto.spec.SecretKeySpec; /** * Basic symmetric encryption example */ public class..."); System.out.println("input text : " + Utils.toHex(input)); // encryption pass byte...: " + Utils.toHex(cipherText) + " bytes: " + ctLength); //decryption pass byte[] plainText
Package categories in Java
It is used for key generation, encryption and decryption
What is OSI Model?
: The Presentation layer is responsible for protocol conversion, date encryption/decryption
Java Security
for controlling Encryption and Decryption. There are two types of key-based... for encryption and decryption. This is also known as 'Secret key... amounts of data, encryption and decryption of data by public-key systems becomes
Java package,Java Packages
for key generation, encryption and decryption. java.awt
Object Output Stream
Object Output Stream  Can anyone decode the data from a file which is written by ObjectOutputStream?? I want to know if this is a secure way to write protected data without encryption
array password - Java Beginners
array password  i had create a GUI of encryption program that used the array password. my question is can we do the password change program? i mean we change the older password with the new password
Java User Validation
on how to encrypt and decryption) in database . Please help, thanks in advance
Write a java program that encrypt and decrypt some string by adding or removing 2 on each character.
Your String : Mamoun Please Enter Your Choice : 1. Encryption. 2. Decrypt ion. 1 Result of Encryption(Mamoun) is (Ocoqwp
servlets
servlets  why we require wrappers in servlets? what are its uses? Please explain   These wrappers classes help you to modify request/response. For e.g. compression, encryption, XSLT etc. Here is an example: http
java - Java Beginners
java  hi.. i have to perform RSA encryption on messages.. i am able to do that with numbers.. but please tell me how to do that with english alphabetical messages.. please if possible provide code for it.. (i m not using JCE
Programming: Prime Numbers - Dialog
to mathematicians) properties. More recently they figure prominently in computer encryption... for really large numbers (ie, those used in encryption), but it's simple
ajax
="index.php?q=<?php echo $this->date_format->encryption('Query','load
streams - Java Beginners
to perform encryption, serialization, compression, translation, and other services
 

 

 

DMCA.com