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

  • Home
  • SEARCH
  • 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 192k
  • Answers 192k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to hash passwords not to encrypt them. Then… May 12, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer I've solved it by setting the UserPaint style in the… May 12, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer If you can splurge on a book, the AspectJ Cookbook… May 12, 2026 at 6:26 pm

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

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.