Question about Borland Turbo C++ Suite 1.0 (TCB0000WWFS180) for PC

Open Question

How to write c/ c++ sourcecode for Merkle-Hellman Knapsack Public Key Cryptosystem ??? In this problem you will implement the Merkle-Hellman Knapsack cryptosystem. The encryption and decryption algorithms are based on solving a knapsack problem. The knapsack problem consists of finding a way to select some of the items to be packed such that their sum (the amount of space they take up) exactly equals the knapsack capacity (the target). Formally the knapsack problem is as follows: Given a set S = {a1, a2, ..., an} and a target sum T, where each ai >= 0, is there a selection vector V={v1,v2,...,vn} each of whose elements is 0 or 1, such that (ai*vi) = T. The idea behind Merkle-Hellman scheme is to encode a binary message as a solution to a knapsack problem reducing the cipher text to the target sum obtained by adding terms corresponding to 1s in the plaintext. That is, blocks of plain text are converted to knapsack sums by adding into the sum the terms that match with 1bits in the plaintext as shown below: Plaintext: 1 0 1 0 0 1 Knapsack: 1 2 5 9 20 43 Cipher text: 49 Plaintext: 0 1 1 0 1 0 Knapsack: 1 2 5 9 20 43 Cipher text: 27 The receiver will have to use the cipher text (the target sum) to recover the plaintext. A knapsack problem is said to be ``easy'' if {missing}. The solution for the easy knapsack problem is straightforward, and can be achieved in O(n).Furthermore, there exists a way for transforming an easy knapsack set S into a non-easy knapsack H simply by multiplying the elements of S by w mod n where w and n are well chosen integers. Formally the terms of H are: hi = (w*si) mod n. For example if S = {1, 2, 4, 9}, w = 15, and n = 17 then H = {15, 13, 9, 6}. Encryption algorithm (executed by the sender) H is called the public key and is made public by the receiver Choose w and 1. n such that n > max(S) and n is prime, and w < n. Construct H from S, w, and n. Sender uses H to encipher blocks of m bits P0 = [p1, p2...pm], P1 = [pm+1, pm+2...p2m] and so forth (m is the number of terms in H), as follows: Ti = Pi*H = (pj*hj). Thus T0 = P0*H, T1 = P1*H and so on. Ti are then transmitted to the receiver via a reliable channel. 1. Decryption algorithm (executed by the receiver) The tuple (S, n, w) is called the private key and is kept secret by the receiver Use w and n to compute w-1 where w-1*w = 1 mod n. if n is prime then w-1 = w (n-2) mod n 2. Compute Ai = w-1*Ti mod n 3. Find Pi by solving Ai = Pi*S Input file The input consists of N test cases. The number of them (N) is given on the first line of the input file. Each test case begins with a line containing a plaintext to be encrypted. The second line contains the number of elements (m) in the knapsack S that show in the third line. The knapsack elements are positive integers separated by space. The fourth line of each text case contains n and w in this order separated by space. Output file Print exactly 3 lines for each test case. The first line should contain the encrypted values of the plaintext of the set separated by space. The second line should contain the plaintext obtained by applying the decryption algorithm to the plaintext, preceded by `Recovered plain text: '. The third line should contain the value of w-1 Sample Input 2 Salaam! 4 1 2 4 9 17 15 hello there? 4 1 2 4 9 19 7 Sample Output 29 25 22 16 22 28 22 16 22 16 22 44 9 16 0 24 Recovered plain text: Salaam! 8 23 7 23 20 23 21 23 21 23 36 9 0 29 14 23 7 23 20 29 9 23 20 15 36 0 16 Recovered plain text: hello there? 11

Posted by on

  • titi_lion Mar 09, 2009

    I try to implement the same algortithm( Merkle-Hellman cryptanalyse)you talk about.I just now if someone can help to start it.

×

1 Suggested Answer

  • 142 Answers

SOURCE: Write an algorithm that reads two values, determines the largest value and prints the largest value with an identifying message.

See if this link helps

https://m.facebook.com/Deegarg05/posts/361813403875586

Posted on Jun 01, 2014

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

What are the major steps taken by Kurud Minister of Chhattisgarh towards the development of kurud?


The Kurud Minister in Chhattisgarh, Ajay Chandrakar reviewed the development works. All district panchayats must cooperate for the successful implementation of Mahatma Gandhi NREGA work. The employment-oriented functions should be also made accessible to those who need more jobs. As Mr. Chandrakar is the head of the department so he has reviewed the development of effective implementation of the government's welfare schemes and programs directed to the benefit of the public.

Jan 11, 2017 | Computers & Internet

1 Answer

What difference between genricServlet and httpServlet


public abstract class GenericServlet extends java.lang.Object implements Servlet, ServletConfig, java.io.Serializable
  • GenericServlet defines a generic, protocol-independent servlet.
  • GenericServlet gives a blueprint and makes writing servlet easier.
  • GenericServlet provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface.
  • GenericServlet implements the log method, declared in the ServletContext interface.
  • To write a generic servlet, it is sufficient to override the abstract service method.
javax.servlet.http.HttpServlet
Signature: public abstract class HttpServlet extends GenericServlet implements java.io.Serializable
  • HttpServlet defines a HTTP protocol specific servlet.
  • HttpServlet gives a blueprint for Http servlet and makes writing them easier.
  • HttpServlet extends the GenericServlet and hence inherits the properties GenericServlet.

May 12, 2011 | Computers & Internet

1 Answer

I need to write a program in c implementing the merklehellman knapsack algorithm.please help me


Find a document describing the algorithm.
Find a textbook that teaches how to program in the C language.
Ask your teacher for additional assistance.

Mar 03, 2011 | Computers & Internet

3 Answers

Write an algorithm for the implementation of a circular doubly linked list


Write an algorithm for the implementation of a circular doubly linked list.

Feb 19, 2011 | Computers & Internet

1 Answer

I need a complete workingsource code written in


This is a simple source code for Simple calculator in Java using RMI
//mathServer//
import java.rmi.*;
import java.rmi.Naming.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.net.*;
import java.util.*;
interface mathInterface extends Remote
{
public int add(int a,int b) throws RemoteException;
public int subt(int a,int b) throws RemoteException;
public int mult(int a,int b) throws RemoteException;
public int div(int a,int b) throws RemoteException;
}
public class mathServer extends UnicastRemoteObject implements
mathInterface
{
public mathServer() throws RemoteException
{
System.out.println("Initializing Server");
}
public int add(int a,int b)
{
return(a+b);
}
public int subt(int a,int b)
{
return(a-b);
}
public int mult(int a,int b)
{
return(a*b);
}
public int div(int a,int b)
{
return(a/b);
}
public static void main(String args[])
{
try
{
mathServer ms=new mathServer();
java.rmi.Naming.rebind("MathServ",ms);
System.out.println("Server Ready");
}
catch(RemoteException RE)
{
System.out.println("Remote Server Error:"+ RE.getMessage());
System.exit(0);
}
catch(MalformedURLException ME)
{
System.out.println("Invalid URL!!");
}
}
}

//mathClient//
import java.rmi.*;
import java.rmi.registry.*;
import java.awt.*;
import java.awt.event.*;
public class mathClient extends Frame implements ActionListener
{
Button B1=new Button("Sum");
Button B2=new Button("Subtract");
Button B3=new Button("Multiply");
Button B4=new Button("Divide");
Label l1=new Label("Number 1");
Label l2=new Label("Number 2");
Label l3=new Label("Result");
TextField t1=new TextField(20);
TextField t2=new TextField(20);
TextField t3=new TextField(20);
public mathClient()
{
super("Calculator");
setLayout(null);
l1.setBounds(20,50,55,25);
add(l1);
l2.setBounds(20,100,55,25);
add(l2);
l3.setBounds(20,150,55,25);
add(l3);
t1.setBounds(150,50,100,25);
add(t1);
t2.setBounds(150,100,100,25);
add(t2);
t3.setBounds(150,150,100,25);
add(t3);
B1.setBounds(20,200,80,25);
add(B1);
B2.setBounds(100,200,80,25);
add(B2);
B3.setBounds(180,200,80,25);
add(B3);
B4.setBounds(260,200,80,25);
add(B4);
B1.addActionListener(this);
B2.addActionListener(this);
B3.addActionListener(this);
B4.addActionListener(this);
addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
}
public void actionPerformed(ActionEvent AE)
{
if(AE.getSource()==B1)
{
sum();
}
else if(AE.getSource()==B2)
{
subt();
}
else if(AE.getSource()==B3)
{
mult();
}
else if(AE.getSource()==B4)
{
div();
}
}
public void sum()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.add(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public void subt()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.subt(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public void mult()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.mult(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public void div()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.div(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public static void main(String args[])
{
mathClient MC=new mathClient();
MC.setVisible(true);
MC.setSize(600,500);
};
}

Jul 03, 2009 | Microsoft Computers & Internet

1 Answer

Hi everybody can anyone help me with the project ''Data Hiding in Audio Files'' project in Java and how to run the project with full source code to


The Circle Class Using Data Hiding and Encapsulation package shapes; // Specify a package for the class public class Circle { // The class is still public // This is a generally useful constant, so we keep it public public static final double PI = 3.14159; protected double r; // Radius is hidden, but visible to subclasses // A method to enforce the restriction on the radius // This is an implementation detail that may be of interest to subclasses protected checkRadius(double radius) { if (radius < 0.0) throw new IllegalArgumentException("radius may not be negative."); } // The constructor method public Circle(double r) { checkRadius(r); this.r = r; } // Public data accessor methods public double getRadius() { return r; }; public void setRadius(double r) { checkRadius(r); this.r = r; } // Methods to operate on the instance field public double area() { return PI * r * r; } public double circumference() { return 2 * PI * r; } }

Mar 25, 2009 | Computers & Internet

1 Answer

Hello,


try CC+ code....
this is the site>>> http://en.pudn.com/downloads3/sourcecode/java/detail11213_en.html

Feb 28, 2009 | Computers & Internet

1 Answer

Is it possible to implement Natting on Cisco WLC 2106


I suggest you to read this, that woult explain all of it for you.

Dec 29, 2008 | Cisco 2106 (AIR-WLC2106-K9)

Not finding what you are looking for?
Borland Turbo C++ Suite 1.0 (TCB0000WWFS180) for PC Logo

Related Topics:

1,208 people viewed this question

Ask a Question

Usually answered in minutes!

Top Borland Computers & Internet Experts

Tony

Level 3 Expert

2598 Answers

Yoav Shilon
Yoav Shilon

Level 2 Expert

104 Answers

k24674

Level 3 Expert

7993 Answers

Are you a Borland Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...