Please I have A playfair cipher, it converts String inputs to Int, but I want Hex










0














import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

This is the public class
public class Process

private String keywordAsString = "";
private String keyword = "";

// ArrayList to hold the letters of the keyword with duplicates removed.
private ArrayList<Integer> keywordAsIntsNoDup = new ArrayList<Integer>(0);

// Map for removing all duplicate letters in the keyword.
private Map<Integer, Integer> keywordLetters = new LinkedHashMap<Integer, Integer>(0);

// ArrayList to hold all 256 ASCII characters (as integers).
private ArrayList<Integer> asciiArray = new ArrayList<Integer>(0);

// ArrayList for storing the message from the file.
ArrayList<Integer> fileMessageAsInteger = new ArrayList<Integer>(0);

// Constructor
public void process()



public void processKeyword(String keyword)

// Copy incoming keyword String
this.keywordAsString = keyword;

// Pass incoming keyword String to the removeDuplicate method.
// removeDuplicate will first convert the letters to Integers,
// then remove any duplicate letters.
// Store the result in the keywordAsIntsNoDup ArrayList
this.keywordAsIntsNoDup = removeDuplicates(this.keywordAsString);

// Create ArrayList and fill it with all 256 ASCII characters (as integers).
createAsciiArr();

// Remove the keyword letters from the asciiArray.
for (int i=0; i<this.keywordAsIntsNoDup.size(); i++)
Integer letterToSearchFor = this.keywordAsIntsNoDup.get(i);
if (this.asciiArray.contains(letterToSearchFor))

this.asciiArray.remove(letterToSearchFor);


// END processKeyword()


public ArrayList<Integer> removeDuplicates(String keyword)

// Copy incoming keyword String
this.keyword = keyword;


I really would appreciate if someone would help me Java is really no piece of cake.
// Loop through the keywordAsIntArray ArrayList, putting each 'letter' of the keyword into the map.
// Duplicate letters will be overridden, so the map will contain the keyword without any duplicates.
for (int i=0; i


 // Put the maps' key set (which holds the 'letters') into an ArrayList.
// This will make it easier to put the 'letters' into the Table later.
ArrayList<Integer> keyslist = new ArrayList<Integer>(this.keywordLetters.keySet());
System.out.println("n" + "map.keySet() from keyslist ArrayList = " + keyslist.toString());

return keyslist;


public void createAsciiArr()

// Use an enhanced for loop to fill the asciiArray ArrayList
// with all 256 ASCII characters as integers.
for (int i=0; i<256; i++)
this.asciiArray.add(i);

// END createAsciiArr()
// END class


Please I want to input String as keyword, then get back hex values as the encrypted code and not integers. Also Please I have more of the codes I dont really understand,am really new to Java. Please can anyone help me.










share|improve this question

















  • 1




    Possible duplicate of Java converting int to hex and back again
    – mx0
    Nov 12 '18 at 17:26










  • From the question code: "all 256 ASCII characters". ASCII does not have 256 characters, it has about 95 displayable characters.
    – zaph
    Nov 12 '18 at 18:01











  • it is actually the expanded AScII which is 256
    – Engr Arome
    Nov 12 '18 at 21:09










  • Consider: Is 0x00 an ASCII character? 0x08?
    – zaph
    Nov 13 '18 at 7:26















0














import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

This is the public class
public class Process

private String keywordAsString = "";
private String keyword = "";

// ArrayList to hold the letters of the keyword with duplicates removed.
private ArrayList<Integer> keywordAsIntsNoDup = new ArrayList<Integer>(0);

// Map for removing all duplicate letters in the keyword.
private Map<Integer, Integer> keywordLetters = new LinkedHashMap<Integer, Integer>(0);

// ArrayList to hold all 256 ASCII characters (as integers).
private ArrayList<Integer> asciiArray = new ArrayList<Integer>(0);

// ArrayList for storing the message from the file.
ArrayList<Integer> fileMessageAsInteger = new ArrayList<Integer>(0);

// Constructor
public void process()



public void processKeyword(String keyword)

// Copy incoming keyword String
this.keywordAsString = keyword;

// Pass incoming keyword String to the removeDuplicate method.
// removeDuplicate will first convert the letters to Integers,
// then remove any duplicate letters.
// Store the result in the keywordAsIntsNoDup ArrayList
this.keywordAsIntsNoDup = removeDuplicates(this.keywordAsString);

// Create ArrayList and fill it with all 256 ASCII characters (as integers).
createAsciiArr();

// Remove the keyword letters from the asciiArray.
for (int i=0; i<this.keywordAsIntsNoDup.size(); i++)
Integer letterToSearchFor = this.keywordAsIntsNoDup.get(i);
if (this.asciiArray.contains(letterToSearchFor))

this.asciiArray.remove(letterToSearchFor);


// END processKeyword()


public ArrayList<Integer> removeDuplicates(String keyword)

// Copy incoming keyword String
this.keyword = keyword;


I really would appreciate if someone would help me Java is really no piece of cake.
// Loop through the keywordAsIntArray ArrayList, putting each 'letter' of the keyword into the map.
// Duplicate letters will be overridden, so the map will contain the keyword without any duplicates.
for (int i=0; i


 // Put the maps' key set (which holds the 'letters') into an ArrayList.
// This will make it easier to put the 'letters' into the Table later.
ArrayList<Integer> keyslist = new ArrayList<Integer>(this.keywordLetters.keySet());
System.out.println("n" + "map.keySet() from keyslist ArrayList = " + keyslist.toString());

return keyslist;


public void createAsciiArr()

// Use an enhanced for loop to fill the asciiArray ArrayList
// with all 256 ASCII characters as integers.
for (int i=0; i<256; i++)
this.asciiArray.add(i);

// END createAsciiArr()
// END class


Please I want to input String as keyword, then get back hex values as the encrypted code and not integers. Also Please I have more of the codes I dont really understand,am really new to Java. Please can anyone help me.










share|improve this question

















  • 1




    Possible duplicate of Java converting int to hex and back again
    – mx0
    Nov 12 '18 at 17:26










  • From the question code: "all 256 ASCII characters". ASCII does not have 256 characters, it has about 95 displayable characters.
    – zaph
    Nov 12 '18 at 18:01











  • it is actually the expanded AScII which is 256
    – Engr Arome
    Nov 12 '18 at 21:09










  • Consider: Is 0x00 an ASCII character? 0x08?
    – zaph
    Nov 13 '18 at 7:26













0












0








0







import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

This is the public class
public class Process

private String keywordAsString = "";
private String keyword = "";

// ArrayList to hold the letters of the keyword with duplicates removed.
private ArrayList<Integer> keywordAsIntsNoDup = new ArrayList<Integer>(0);

// Map for removing all duplicate letters in the keyword.
private Map<Integer, Integer> keywordLetters = new LinkedHashMap<Integer, Integer>(0);

// ArrayList to hold all 256 ASCII characters (as integers).
private ArrayList<Integer> asciiArray = new ArrayList<Integer>(0);

// ArrayList for storing the message from the file.
ArrayList<Integer> fileMessageAsInteger = new ArrayList<Integer>(0);

// Constructor
public void process()



public void processKeyword(String keyword)

// Copy incoming keyword String
this.keywordAsString = keyword;

// Pass incoming keyword String to the removeDuplicate method.
// removeDuplicate will first convert the letters to Integers,
// then remove any duplicate letters.
// Store the result in the keywordAsIntsNoDup ArrayList
this.keywordAsIntsNoDup = removeDuplicates(this.keywordAsString);

// Create ArrayList and fill it with all 256 ASCII characters (as integers).
createAsciiArr();

// Remove the keyword letters from the asciiArray.
for (int i=0; i<this.keywordAsIntsNoDup.size(); i++)
Integer letterToSearchFor = this.keywordAsIntsNoDup.get(i);
if (this.asciiArray.contains(letterToSearchFor))

this.asciiArray.remove(letterToSearchFor);


// END processKeyword()


public ArrayList<Integer> removeDuplicates(String keyword)

// Copy incoming keyword String
this.keyword = keyword;


I really would appreciate if someone would help me Java is really no piece of cake.
// Loop through the keywordAsIntArray ArrayList, putting each 'letter' of the keyword into the map.
// Duplicate letters will be overridden, so the map will contain the keyword without any duplicates.
for (int i=0; i


 // Put the maps' key set (which holds the 'letters') into an ArrayList.
// This will make it easier to put the 'letters' into the Table later.
ArrayList<Integer> keyslist = new ArrayList<Integer>(this.keywordLetters.keySet());
System.out.println("n" + "map.keySet() from keyslist ArrayList = " + keyslist.toString());

return keyslist;


public void createAsciiArr()

// Use an enhanced for loop to fill the asciiArray ArrayList
// with all 256 ASCII characters as integers.
for (int i=0; i<256; i++)
this.asciiArray.add(i);

// END createAsciiArr()
// END class


Please I want to input String as keyword, then get back hex values as the encrypted code and not integers. Also Please I have more of the codes I dont really understand,am really new to Java. Please can anyone help me.










share|improve this question













import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

This is the public class
public class Process

private String keywordAsString = "";
private String keyword = "";

// ArrayList to hold the letters of the keyword with duplicates removed.
private ArrayList<Integer> keywordAsIntsNoDup = new ArrayList<Integer>(0);

// Map for removing all duplicate letters in the keyword.
private Map<Integer, Integer> keywordLetters = new LinkedHashMap<Integer, Integer>(0);

// ArrayList to hold all 256 ASCII characters (as integers).
private ArrayList<Integer> asciiArray = new ArrayList<Integer>(0);

// ArrayList for storing the message from the file.
ArrayList<Integer> fileMessageAsInteger = new ArrayList<Integer>(0);

// Constructor
public void process()



public void processKeyword(String keyword)

// Copy incoming keyword String
this.keywordAsString = keyword;

// Pass incoming keyword String to the removeDuplicate method.
// removeDuplicate will first convert the letters to Integers,
// then remove any duplicate letters.
// Store the result in the keywordAsIntsNoDup ArrayList
this.keywordAsIntsNoDup = removeDuplicates(this.keywordAsString);

// Create ArrayList and fill it with all 256 ASCII characters (as integers).
createAsciiArr();

// Remove the keyword letters from the asciiArray.
for (int i=0; i<this.keywordAsIntsNoDup.size(); i++)
Integer letterToSearchFor = this.keywordAsIntsNoDup.get(i);
if (this.asciiArray.contains(letterToSearchFor))

this.asciiArray.remove(letterToSearchFor);


// END processKeyword()


public ArrayList<Integer> removeDuplicates(String keyword)

// Copy incoming keyword String
this.keyword = keyword;


I really would appreciate if someone would help me Java is really no piece of cake.
// Loop through the keywordAsIntArray ArrayList, putting each 'letter' of the keyword into the map.
// Duplicate letters will be overridden, so the map will contain the keyword without any duplicates.
for (int i=0; i


 // Put the maps' key set (which holds the 'letters') into an ArrayList.
// This will make it easier to put the 'letters' into the Table later.
ArrayList<Integer> keyslist = new ArrayList<Integer>(this.keywordLetters.keySet());
System.out.println("n" + "map.keySet() from keyslist ArrayList = " + keyslist.toString());

return keyslist;


public void createAsciiArr()

// Use an enhanced for loop to fill the asciiArray ArrayList
// with all 256 ASCII characters as integers.
for (int i=0; i<256; i++)
this.asciiArray.add(i);

// END createAsciiArr()
// END class


Please I want to input String as keyword, then get back hex values as the encrypted code and not integers. Also Please I have more of the codes I dont really understand,am really new to Java. Please can anyone help me.







string integer hex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 16:16









Engr Arome

41




41







  • 1




    Possible duplicate of Java converting int to hex and back again
    – mx0
    Nov 12 '18 at 17:26










  • From the question code: "all 256 ASCII characters". ASCII does not have 256 characters, it has about 95 displayable characters.
    – zaph
    Nov 12 '18 at 18:01











  • it is actually the expanded AScII which is 256
    – Engr Arome
    Nov 12 '18 at 21:09










  • Consider: Is 0x00 an ASCII character? 0x08?
    – zaph
    Nov 13 '18 at 7:26












  • 1




    Possible duplicate of Java converting int to hex and back again
    – mx0
    Nov 12 '18 at 17:26










  • From the question code: "all 256 ASCII characters". ASCII does not have 256 characters, it has about 95 displayable characters.
    – zaph
    Nov 12 '18 at 18:01











  • it is actually the expanded AScII which is 256
    – Engr Arome
    Nov 12 '18 at 21:09










  • Consider: Is 0x00 an ASCII character? 0x08?
    – zaph
    Nov 13 '18 at 7:26







1




1




Possible duplicate of Java converting int to hex and back again
– mx0
Nov 12 '18 at 17:26




Possible duplicate of Java converting int to hex and back again
– mx0
Nov 12 '18 at 17:26












From the question code: "all 256 ASCII characters". ASCII does not have 256 characters, it has about 95 displayable characters.
– zaph
Nov 12 '18 at 18:01





From the question code: "all 256 ASCII characters". ASCII does not have 256 characters, it has about 95 displayable characters.
– zaph
Nov 12 '18 at 18:01













it is actually the expanded AScII which is 256
– Engr Arome
Nov 12 '18 at 21:09




it is actually the expanded AScII which is 256
– Engr Arome
Nov 12 '18 at 21:09












Consider: Is 0x00 an ASCII character? 0x08?
– zaph
Nov 13 '18 at 7:26




Consider: Is 0x00 an ASCII character? 0x08?
– zaph
Nov 13 '18 at 7:26

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266111%2fplease-i-have-a-playfair-cipher-it-converts-string-inputs-to-int-but-i-want-he%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266111%2fplease-i-have-a-playfair-cipher-it-converts-string-inputs-to-int-but-i-want-he%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto