Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 119203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:36:57+00:00 2026-05-11T03:36:57+00:00

I’m a German student and for computer classes I need to implement the DES-encryption

  • 0

I’m a German student and for computer classes I need to implement the DES-encryption in Java (by myself, not by using the Java-API) and explain it in detail. I didn’t find any Java-code-examples using google, however I did find an easy implementation in C. (I do not know C, I know a little C++, but not that well, pointer still get me now and then.)

So I tried simply converting the code from C to Java, which did work out about halfway, however I’m having a problem with the last part, especially with the example using:

printf('%c',M); 

Which, from what Google told me, seems to be converting numbers(Integer) to ASCII-Characters, but I’m not really sure. My Code seems to be working until that last part, so I would be thankful for anyone that can give me fix/hint.

My Code:

import java.util.Scanner;  public class DES {      /**      * @param args      */     public static void main(String[] args) {          Scanner eingabe = new Scanner(System.in);          int p, q, key2, fn, encryption_key, temp1 , temp2 ,             t, s =0 , privatekey1=1, b=0 , passwort_s=0, klartext;         int[] Cipher = new int [100];         String passwort;          System.out.println('Enter the value of p and q');          p = eingabe.nextInt();         q = eingabe.nextInt();          System.out.println(p);         System.out.println(q);          key2= p*q;           fn=(p-1)*(q-1);         System.out.println('Enter Enryption key e: ');         encryption_key = eingabe.nextInt();          do {              s=(privatekey1*encryption_key)%fn;             privatekey1++;           } while (s!=1);           privatekey1=privatekey1-1;            System.out.println('Public Key : '+ encryption_key + ','+ key2 );         System.out.println('Private Key: '+ privatekey1 + ',' +key2 );         System.out.println('Enter Message: ');         passwort= eingabe.next();         for ( temp2 = 0; temp2 < passwort.length(); temp2++)          {             t = passwort.charAt(temp2);             passwort_s=1;             for(temp1 =0 ; temp1< encryption_key ; temp1++){                 passwort_s= passwort_s*t%key2;             }             passwort_s= passwort_s%key2;             System.out.println(passwort_s);         }          System.out.println('Enter cipher Text: ');         for(temp1=0;temp1< passwort.length(); temp1++ )         {             Cipher[temp1]= eingabe.nextInt();         }          System.out.println('Plainttext: ');         for(temp2 =0; temp2 < passwort.length(); temp2++);         {             klartext=1;              for(temp1 =0; temp1 < privatekey1; temp1 ++){                 klartext=klartext*Cipher[temp2]%key2;             }             klartext=klartext%key2;             System.out.println(klartext);         }     } } 

How can I convert the

printf('%c',M); 

to Java, and is this then a full DES implementation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:36:58+00:00Added an answer on May 11, 2026 at 3:36 am

    Its late and I’m tired but this isn’t a DES implementation, is it?

    It looks more like RSA.

    Yeah the link on your post is an asymmetrical cryptosystem. DES is symmetrical.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer class Program { static void Main(string[] args) { Timer timer… May 11, 2026 at 10:50 pm
  • Editorial Team
    Editorial Team added an answer Use GROUP_CONCAT SELECT GROUP_CONCAT(bar) FROM TABLE GROUP BY foo; May 11, 2026 at 10:50 pm
  • Editorial Team
    Editorial Team added an answer Your code doesn't work because the function is not returning… May 11, 2026 at 10:50 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.