Help: Substitution cipher

Hi:
The following program is to suppose to be an alphabet substitution cipher. A keyword is taken from the command and added to a reverse alphabet string. Duplicate letters are removed. The string is then put into an array. The array is then used to encrypt incoming text by substituting characters based on position.
The methods I have developed seem to work. The problem I am having is the actual substitution of characters. I keep getting the error message java.lang.ArrayIndexOutOfBoundsException. Please give input on how I could correct this problem and make the program work.
Thanks.
C:\jdk1.2.2\bin>java Monoalphabet feather in.txt out4.txt
Exception: java.lang.ArrayIndexOutOfBoundsExceptionimport java.io.*;
class Monoalphabet {
  public static void main(String args[]) {
    String keyword = args[0];
    try {
     int positionOfA = 'a';
     String incoming = "";
     String temp = "";
     String outgoing = "";
     // Create a file reader
     FileReader f = new FileReader(args[1]);
     BufferedReader infile  = new BufferedReader(f); 
     // Create a file writer
     FileWriter f1 = new FileWriter(args[2]);
      while((temp = infile.readLine()) != null)
          for (int k = 0; k < temp.length(); k++)
          char whatever = temp.charAt(k);
          char [] c = makeCypher(keyword);
          char ch = c [(int)whatever -  positionOfA];//causes an error
          String chs = new Character (ch).toString();
       outgoing = outgoing + chs;
         f1.write(outgoing);
      // Close the file writer
      f1.close();
      // Close file reader
      f.close();
    catch(Exception e) {
      System.out.println("Exception: " + e);
  public static String removeDups(String keyword)
  { String remove = "";
    keyword = keyword + "zyxwvutsrqponmlkjihgfedcba";
   for(int i = keyword.length()-1; i > -1 ; i--)
   if(i == keyword.indexOf(keyword.charAt(i)))
    remove = keyword.charAt(i)+ remove;
    return remove; 
  public static  char[] makeCypher(String keyword)
      int len = keyword.length();// putting the characters in an array
      char Array[] = new char[ len ];
      for (int i =0;i < keyword.length();i++)
     { Array = keyword.charAt(i);
return Array;// Is this the correct?

What is the size of your array, and what is the index being used in the array which causes this to fail? This is standard debugging work that you should be doing when you get this type of error.

Similar Messages

  • Simple Substitution Cipher: What Went Wrong?

    I've written a simple program that enables a user to type in the name of a plain text file, then have the file encoding using a simple (+1)substitution cipher. The program compiles, but when the encoded file displays, it displays on the first character of each word. The plain text file consists of the sentence "Now is the time for all good men to come to the aid of their party". Any assistance would be greatly appreciated. The code is as follows:
    import java.io.*;
    class FileReadText
         public static void main(String[] args) throws IOException
               BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
              String fileName;
                   System.out.println("What file would you like to encrypt?");
              fileName = input.readLine();
            BufferedReader inFile = new BufferedReader(new FileReader(fileName));
              char[] cipher = {'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
                   'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
                   'z', 'a'};
              char[] txt = fileName.toCharArray();
              char[] encTxt = new char[txt.length];
              for(int i = 0; i < txt.length; i++)
                   if(txt[i] >= 'a' && txt[i] <= 'z')
                           encTxt[i] = cipher[txt[i] - 'a'];
                   else
                             encTxt[i] = txt;
                                  System.out.println(encTxt[i]);
              inFile.close();

    When do you actually read from the file? It looks like you're just trying to encrypt the filename. So if the filename was "test.txt" that's what you would be encrypting instead of "Now is the time for all good men to come to the aid of their party". That's the most obvious problem I see at least.

  • HELP with a simple substitution cipher!?!?!

    This is one of my homework problems and i don't really understand how to do this at all,
    my teacher said i need to use arrays and not strings.
    so could some one find a good example of this so i can try it out myself. (i cant find one?!?!)
    thanks!??!
    Design an algorithm Java program that takes a word (an array of characters) and produces the encoded version of the word (another array of characters) using the above key table to do the encoding. Once the algorithm has encoded the word, it should then decode the word into a third array of characters (which if done correctly, should be the same as the original word.

    slvr99 wrote:
    your still a virgin, balding and living, in ur moms basement
    fuck youNice work. You have demonstrated exactly as much intelligence, creativity, and class as I had expected from you.

  • Help with project...

    I have aproject to do in my cs class. I seriously do not know what to do here:
    "For this project you will write a program that will aid in the cracking of a substitution cipher. Basically, it is a form of frequency analysis. Your program will read in a String as input from the user and count the number of times each letter appears in the String. It will then print out the frequency of each letter, along with a decimal frequency or percentage (your choice). You must use an array for this program - you will be severely penalized for not using an array. After running your program your output may look something like this:
    Welcome to Letter Frequency Analyzer v. 1.0
    Enter a String to be analyzed: The quick brown fox jumps over the lazy dog.
    Letter Frequencies
    ==================
    A12.86%
    B12.86%
    C12.86%
    D12.86%
    E38.57%
    F12.86%
    G12.86%
    H25.71%
    I12.86%
    J12.86%
    K12.86%
    L12.86%
    M12.86%
    N12.86%
    O411.43%
    P12.86%
    Q12.86%
    R25.71%
    S12.86%
    T25.71%
    U25.71%
    V12.86%
    W12.86%
    X12.86%
    Y12.86%
    Z12.86%
    How does this help crack a substitution cipher? By using the letter frequencies of letters in the English language, we can make educated guesses about which letters are substituted for the most common letters (ie. the most common would be e, the next most common would be t, etc). This, of course, would not work for some ciphertexts (like the one in the example), but it should work for most of the cryptogram puzzles that you find in the newspaper.
    Hints: Your array should contain 26 elements that you will store the frequency of each letter. The main part of your program will first convert the input String to uppercase, and then use a for loop to go through each letter of the String, incrementing the appropriate index in the array. You do not need a 26 case switch statement to do this! You can cleverly use casting and the unicode values of each letter (see the appendix in your book) to index into the array. My version of this program (that produced the output above) was only 31 lines of code (including 3 blank lines, 5 lines with only brackets, the class and main method definitions, an import statement, etc - in other words, I wrote it just like I write any other program). If you can keep the number of lines in your program at or below 45 (and maintain good coding style), you will receive a 10 point bonus for this project! (the 45 lines do not include the normal 5 line header required at the top of all source code submissions)"
    Wtf mate??
    Your help is greatly appreciated!
    Steve

    One of the unwritten rules of this forum is that we don't do other people's homework. But I will give you a hint:
    You can cast a character to an integer, if you do you get its unicode value as a number A is \u0041 (in hexadecimal), so the number you get is 65. B is 66, Z is 90.

  • Schannel cipher suites and ChaCha20

    Is there a blog or other communications channel devoted to the PKI internals of Windows? Most security researchers focus on Linux web servers/OpenSSL, but there are folks in the Windows world who really care about this stuff too, and we'd like to hear
    about what the Windows PKI developers are working on and planning, and perhaps interact with comments and suggestions.
    Because I couldn't find any discussion about Schannel development, I started a
    feature suggestion on the Windows User Voice site for Microsoft to add ChaCha20-Poly1305 cipher suites to Schannel, mostly for the benefit of mobile visitors to IIS websites, but also to help Windows phones and tablets that don't have integrated CPU extensions
    for GCM encryption (improved speed and reduced power consumption).
    It's frustrating to be a security-focused IIS website administrator. Schannel is a "black box" that we can't tinker with or extend ourselves, and support for modern ciphers has been lagging behind other website and client software (it looks like we'll
    at least finally get strong and forward secret ECDHE_RSA + AES + GCM suites with Windows 10 and Server vNext/2016). The methods for configuring cipher suite orders and TLS versions could really use a rethink too (thank goodness for IISCrypto).

    Hi Jamie_E,
    May the following article can help you,
    Cipher Suites in Schannel
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa374757%28v=vs.85%29.aspx
    Managing SSL for a Client Access Server
    http://technet.microsoft.com/en-us/library/bb310795.aspx
    Configuring Secure Sockets Layer in IIS 7
    http://technet.microsoft.com/en-us/library/cc771438(WS.10).aspx
    How to enable Schannel event logging in IIS
    https://vkbexternal.partners.extranet.microsoft.com/VKBWeb/?portalId=1#
    How to restrict the use of certain cryptographic algorithms and protocols in Schannel.dll
    http://support.microsoft.com/kb/245030/EN-US
    I’m glad to be of help to you!
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Cipher transformation that outputs non-padded plaintext final partial block

    I have written some Java code to read from and write to an existing data format that encrypts its data using a known symmetric key. It appears to be using the "AES/ECB/NoPadding" transformation / algorithm for all blocks, except for the final block, if the final block is a partial block. Any partial final block is just written out plaintext. When I use an "AES/ECB/NoPadding" Cipher in a CipherInputStream or a CipherOutputStream to read from or write to such a byte stream, respectively, everything works fine, except that any partial final block is omitted, as is expected from what I know of the behavior of "AES/ECB/NoPadding".
    (FYI, all of these questions relate to the Oracle JDK 7u2. For classes whose source is not included with this JDK, e.g., com.sun.crypto.provider.AESCipher, I looked at the source from the OpenJDK 7u2. I only looked at the default crypto provider included in the JDK, which I assume is the SunJCE, but I may be wrong.)
    1) Is there any other transformation that will properly decrypt / encrypt all the full blocks, but read / write, respectively, a partial final block as plaintext? (I assume not, but I also assume that it won't hurt to ask)
    2) Is there any way to obtain the buffered partial final block's data from Cipher? I can get the length of the leftover data from getOutputSize(0), but I haven't found a way to get the content. (I assume that this is done intentionally, to keep the Cipher-related classes as secure as possible)
    If I knew the length of the input, I could just determine the index of the end of the last full block, but I'd like this code to work with any arbitrary InputStream, and there's no way to know the length of an InputStream (without reading until you receive a -1, of course).
    I will probably wind up using a wrapping InputStream / OutputStream that always buffers the last partial block read from / written to it, respectively, until it's received a -1 from a read, or a flush call, respectively, but I wanted to avoid this if I could possibly use the crypto API more effectively.
    As an aside, I investigated exposing a partial final block's data by creating a wrapper class for one or more of the crypto classes. This appears difficult since many of these classes are final. Some other non-final crypto classes have final methods that use non-exposed private members, so those might be difficult, if not impossible, to wrap properly. The best plan that I devised is to create a CipherSpi subclass that wraps around a Cipher, and then use a Cipher subclass that wraps around both the wrapping CipherSpi subclass and the original Cipher. This appears convoluted, so I haven't yet thoroughly investigated its feasibility.
    I don't think that I can plug in a new mode or padding implementation to the existing SunJCE classes, since com.sun.crypto.provider.CipherCore seems to limit the potential implementations to those of which it is already aware.
    Please let me know if I've overlooked or misunderstood anything (this is the first time that I've used the crypto API).
    Thanks.

    Ross wrote:
    It's an existing data format from a huge company. I can't change it, so I cannot switch to CBC or any other mode that is not compatible with ECB for all but a partial final block. If the existing data format is not binary then you have another problem. Ciphertext is binary and storing binary in a 'char' or 'varchar' column is likely to corrupt the ciphertext and in order to reversibly convert it to ASCII or one of the other character encodings then you are going to have to encode it as Base64 (approx 33% inflation), Hex (100% inflation) or ASCII85 (approx 25% inflation).
    I'm just trying to read and write from it. I don't care about security, since the data is on my computer, and it's not sensitive data (at all; it's data about music files). I don't understand this. If it's not sensitive then why are you considering encrypting it? Seems to me to be a pointless requirement!
    I will never transmit the data anywhere, and, even if someone got hold of the data, I wouldn't care in the slightest.Again, why encrypt it then?
    >
    You're definitely right about it being a major security bug, though, so thanks for the recommendation. I just want a nice programmatic interface to read and write the data. I understand why the crypto API would want to make it difficult to obtain partial final block info, but was just wondering if there is any easy way to obtain it anyway. You could use one of the stream ciphers or one of the techniques that turns a block cipher into a stream cipher resulting in one byte per byte. To make it secure you will still need to use a random IV (or something similar) so there will still be an inflation. You can normally get away with just 8 bytes for the IV. The output is still binary bytes and will need to be encoded (Base64, Hex or ASCII85) if you are going to try to store it in a 'char' or 'varchar' which will result in further inflation.
    I just wrote the cyclic buffer & associated input & output streams, so I'll probably just use those since I probably won't be able to extricate the partial final block from the crypto classes.I don't understand this.
    Note - pretty much every time one encrypts data one ends up with ciphertext longer than the cleartext. This is fundamental to encryption and is nothing particularly to do with Java. One can often use compression of the original cleartext prior to encryption but this does not guarantee to result in smaller ciphertext than cleartext.
    Note 1 - it seems to me that all you are trying to do is obfuscate the data so why not just use a simple insecure substitution cipher? This way you end up with ciphertext of the same length as the cleartext and using the same character set so nothing in the database structure has to change.

  • Can the encrypted string contain only alphabets?

    Hi friends,
    I have problem with the encryption. I am using Des .
    I want to get the encrypted string which contains only alphabets ( no digits or no special characters).
    Help appreciated.
    Thanks.

    Within the Java Cryptographic Extension (JCE), encryption works on bytes and generates bytes. You can convert any arbitrary String to bytes using one of the String.getBytes() methods (preferably the one where you define the encoding to use). The way you restrict what the plane text String contains is up to you.
    The JCE produces secure encryption based on well tested algorithms.
    The tone of your question implies that all you want to do is have a simple substitution cipher. The is very VERY VERY insecure and can be broken by a 2 year old. Use the JCE.

  • Regex Dictionary Lookup

    Hello,
    I think regular expressions is what i need to solve this but i am not sure - any guidance would be appreciated..
    I have created a program to decrtpyt a monoalphabetic substitution cipher - and have extracted text as follows:
    teabeganasamedicineandgrewintoabeverage.inchina,intheeighthcentury,
    Decrypted text has no spaces in... i need to restore the spaces.
    I have an english dictionary text file in the format~:
    +mahogany
    mahout
    maid
    maiden
    maidenhair
    maidenhead
    maidenhood
    maidenly
    ...+
    I need to somehow use this english dictionary to identify the words in the text and add a space at the end of them.
    Any ideas how a regexp would do this for me in Java?
    Rgds,
    Andy

    patonar wrote:
    Yes i know the result may end up incorrect - but as it is a decryption, it is never going to be 100% prescise... without some form of human intervention.
    My lecturer said this when i asked for help reinstating the spaces:
    *+ , the secret is to use the
    dictionary or word list - for example the group of letters 'cupof' won't be in the
    dictionary so you can search for partial matches in the dictionary - you may find
    regular expressions helpful?+*
    Having never used regexp before i dont have a clue how to approach this - or even if this is the right method...
    Im not looking for someone to do this for me - just advise on the best way to do it.
    Rgds,
    AndyThere are a few users here that are really good at regexp, they might read this later and say that regexp might be a possible solution. I have used regexp pretty much but the first solution that I can think of is to build a tree out of all valid words and traverse that tree while you are looking at your string without spaces. I would look for the longest possible match, insert a space and then try to find next word. One problem is that you might be forced to backtrack so it sounds like you need something that is recursive.
    A good start might be to read about Trie:
    http://en.wikipedia.org/wiki/Ternary_search_tree
    Hmm.. this sounds pretty advanced. At what level are you?

  • Conditional display in a SQL-Report/Report Region

    Hi,
    here I have an example for "Conditional display in a SQL-Report/Report Region". I figured it out in Firefox 3.6.2 using Firebug as development tool on Apex 3.2.1.00.12.
    First you have to put the following javascript code in the Page HTML-Header:
    <script type="text/javascript">
    <!--
    // SOURCE
    // W:\oracle\PRJ DWLS\javascript.07.js
    // Beispiel Funktion zur bedingten Formatierung einer Tabellenzelle.
    // Help (Substitution Strings):
    // http://htmldb.oracle.com/pls/otn/wwv_flow_help.show_help?p_lang=de&p_session=2412201185523196&p_flow_id=4003&p_step_id=420,4003
    // HTML Expression:
    // <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#DFT_COND1#
    function ex_conditional_td
    ( p_id
    , p_rownum
    , p_cellnum
      var l_td;
      l_td = vd_getColumn(p_id, p_rownum, p_cellnum);
      // hier die Bedingung definieren
      if (true) {
        l_td.style.color = '#808080';
    }  // -- eof ex_conditional_td -- //
    // Beispiel Funktion zum Abstellen der onMouse Funktionalität der Tabellenzeile
    // HTML Expression:
    // <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#DFT_ID#"
    function ex_conditional_tr
    ( p_id
    , p_rownum
      var l_tr;    // TABLE.TR
      var l_td;    // TABLE.TR.TD
      if (true) {
        l_tr = vd_getRow(p_id, p_rownum);
        l_tr.onmouseover = null;
        l_tr.onmouseout  = null;
        for (var i=0; i<l_tr.cells.length; i++) {
          l_td = l_tr.cells;
    l_td.style.backgroundColor = '#DDDDDD';
    } // -- eof ex_conditional_tr() -- //
    var g_DEBUG = false;
    var g_TBODY = null;
    // Liefert das Body-Element der Tabelle mit der ID <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // Return
    // das Body-Element oder NULL, wenn die Zeile nicht gefunden wurde
    function vd_getBody
    ( p_id
    if (g_TBODY == null) {
    var l_table = null;
    l_table = document.getElementById( p_id );
    if (l_table == null) {
    l_table = document.getElementByName( p_id );
    if (l_table != null) {
    if (vd_debug()) {
    alert("Tabelle gefunden, " + l_table.nodeName);
    g_TBODY = vd_search( l_table, 'TD', 't10data', 'TBODY');
    return g_TBODY;
    } // -- eof vd_getBody() -- //
    // Liefert die Zeile <p_rownum> der HTML-Tabelle mit der Id <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // p_rownum - die Zeilennummer
    // Return
    // die Zeile oder NULL, wenn die Zeile nicht gefunden wurde
    function vd_getRow
    ( p_id
    , p_rownum
    var l_body = vd_getBody(p_id);
    if ( l_body != null
    && l_body.nodeName == 'TBODY'
    && l_body.children[p_rownum].nodeName == 'TR') {
    return l_body.children[p_rownum];
    else {
    return null;
    } // -- eof vd_getRow() -- //
    // Liefert die Spalte <p_column> der Zeile <p_rownum> der HTML-Tabelle mit der
    // Id <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // p_rownum - die Zeilennummer
    // p_column - der Index der Spalte / Zelle
    // Return
    // die Zelle oder NULL, wenn die Zelle nicht gefunden wurde
    function vd_getColumn
    ( p_id
    , p_rownum
    , p_column
    var l_tr = vd_getRow(p_id, p_rownum);
    if ( l_tr != null
    && l_tr.nodeName == 'TR'
    && l_tr.children.length >= p_column
    && l_tr.children[p_column].nodeName == 'TD') {
    return l_tr.children[p_column];
    else {
    return null;
    } // -- eof vd_getColumn() -- //
    // Rekursives Suchen nach einem Node.
    // Zweck: Das bedingte Formatieren einer Tabellenzelle in einem Apex Standard
    // SQL-Report.
    // Diese Funktion durchsucht rekursiv, ab einem Ausgangsknoten <p_node>, alle
    // darunter befindlichen Elemente, ob in dem Element <p_seachIn> sich die
    // Klasse <p_class> befindet.
    // Bei Standard-Reports ist die Reportzelle (TD) mit der Klasse
    // "t10data" formatiert.
    // Zunächst muss dazu die Tabellenzelle (TD) selbst, die übergeordnete
    // Tabellenzeile (TR), der Tabellenbody (TBODY) oder die Tabelle (TABLE)
    // selbst ermittelt werden.
    // Der Beispielaufruf:
    // var l_body;
    // var l_node = document.getElementById( 'R112233' );
    // l_body = search( l_node, 'TD', 't10data', 'TBODY');
    // durchsucht also das mit der Id "R112233" versehene Element [der Report, für
    // den in Apex eine statischen ID vergeben werden musste] rekursiv, bis er
    // die [erste] Tabellenzelle "TD" findet, die als Klasse "t10data"
    // definiert hat. Für diese ermittelt er dann das übergeordnete TBODY-Element.
    // Parameter
    // p_node - das Ausgangselement
    // p_searchIn - der Knotenname, der durchsucht werden soll
    // [node.nodeName == p_searchIn]
    // p_class - der Name der CSS Klasse
    // [node.classList[<index>] == p_class
    // p_parentName - der Name [node.parentNode.nodeName == p_parentName]
    // des Elements, das zurückgeliefert werden soll. Wird als
    // p_parentName der Suchname p_searchIn angegeben, wird
    // das Element selbst zurückgegeben.
    // Return
    // das per p_parentName gesuchte Element (TD, TR, TBODY, TABLE)
    function vd_search
    ( p_node
    , p_searchIn
    , p_class
    , p_parentName
    var LN = "vd_search";
    var l_element = null;
    // DEBUG
    if (vd_debug()) {
    alert(LN + ":" + "Untersuche " + p_node.nodeName + ", id=" + p_node.id);
    // 1) der aktuelle Knoten ist der, der durchsucht werden soll
    if (p_node.nodeName == p_searchIn) {
    if (p_node.classList.length > 0) {
    for(var c=0; c<p_node.classList.length; c++) {
    if (p_node.classList[c] == p_class) {
    // Parent Node dynmisch suchen
    l_node = p_node;
    if (l_node.nodeName == p_parentName) {
    return l_node;
    while(l_node != null && l_node.parentNode != null) {
    if (l_node.parentNode.nodeName == p_parentName) {
    return l_node.parentNode;
    else {
    l_node = l_node.parentNode;
    // 2) wenn nicht 1) oder nicht in 1) gefunden, dann in den Kindelementen
    // weitersuchen
    if (p_node.children.length > 0) {
    var i = 0;
    while (i<p_node.children.length && l_element==null) {
    l_element = vd_search( p_node.children[i], p_searchIn, p_class, p_parentName);
    i++;
    return l_element;
    } // -- eof vd_search() -- //
    // Gibt an, ob Debug ein- (true) oder ausgeschaltet (false) ist.
    // Return
    // true - debug ist eingeschaltet
    // false - debug ist ausgeschaltet
    function vd_debug()
    return g_DEBUG;
    -->
    </script>
    Maybe you have to modify the "vd_getBody" function. I'm searching the table cell with having the class "t10data". When you use another theme, there's maybe another class used.
    Second is, that you set an static id for your report region. I prefer this structure:
    R<app-id><page-id><seq> (Raaaaappppsss) e.g. R094260001010.
    First example is to turn off the onMouse-Effect. Maybe on the first or last column definition you put this code in the "HTML-Expression" area:
    <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#ID#This will call the example function ex_conditional_tr with the parameter
    a) the region id
    b) the rownum (as oracle always starts with 1 this is the first data row [rownum=0 is the table header row])
    Second example is the conditional formatting of a table cell. Put this in the HML-Expression area:
    <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#ENAME#This will call the example function ex_conditional_tr with the parameter
    a) the region id
    b) the rownum
    c) the cellnum (here we have to subtract 1 to get the "real" cell index)
    The "ex_conditional" functions are just a representation of how to get the row or cell node.
    Hope this help a bit.
    Tom

    I would use a CASE statement in the select....
    each CASE would be an img src tag for a different button if the button is an image.
    does that make sense? I can include an example if you would like...

  • How to use 2 GL for loss made on asset retirement w/o revenue ?

    how to use 2 GL for loss made on asset retirement w/o revenue.
    hello everyone
    i have some trouble.
    my company want to use 2 GL account for asset retirement
    example  some time use GL 6500001  some time use 6500002
    in standard configuration AO90 , field loss made on asset retirement w/o revenue, there is only one field.
    so i can use only one G/L.
    it' s not good if i must to change configuration (and transport request )every time that user need to change GL.
    now i got one idea.
    i know that table T095 keep account determinaton and GL account data.
    so if i make program that change data from table T095 directly. i donot need to change config everytime.
    but i am not sure that this way will make impact other standard program or not.
    i will wait for better idea from everyone.
    please help.

    Substitution consist of several steps  each with two parts:
    1- Prerequisite
    2- Replacement
    If the prerequisite is satisfied (TRUE), substitution (Replacement) is performed.
    Transaction Code: OBBH.
    Thank you
    Javed

  • Any extremely weak encryption suggestions?

    I have an XML file that contains information on how to connect to a database, including the username and the password. I would like to make the password human-unreadable.
    Essentially what I am trying to do is make it such that the department secretary (i.e., casual users) cannot just simply look at the XML file and get the information needed; we have decided that it's not worth the time and effort to secure the password against determined crackers because they will more than likely be able to exploit other holes or use specialized tools. In other words, obsfucation rather than true security.
    I'd like to go with something like Rot13, have the JavaBean do a simple substitution cipher on the password string when the time comes to write it to the XML file, and likewise, read the data back from the file. Other members of the team have suggested hard coding the seed into the class file, and doing a random number substitution.
    Any suggestions?

    As mentioned elsewhere in this forum, Sun doesn't provide Base64 encoding and decoding within its standard libraries (that I'm aware of). For something as trivial as this, I really don't want to suggest to the customer that they download and install a third party library.
    Granted, he's going to have to install my classes, but I legally can't package someone else's Base64 into my jar file, and I don't want to tell him to use implementation A in the common libraries, and then have someone else come along demanding implementation B.
    Rolling my own version of Base64 is a definite possibility, but I'd like to wait and see what else is suggested. :)

  • Cin's getline function

    hi everybody,
    i wrote a program that decodes a text file that has been encrypted using a substitution cipher
    i've never used cin's getline function before ... can anyone tell me please how can i prompt the user for a file name, and read the file name from the keyboard using cin's getline function. It should open the file designated by the file name. If you can't open it, print an error message and exit. If you can open it, then the program should decode the contents and display them on the monitor.
    Here is my program:
    #include<iostream>
    using namespace std;
    int main() {
    char szPoem[] =
    "7Staqnjxy4tk4ywjjx4ymj4hmjwwd4stb"
    "7Px4mzsl4bnym4gqttr4fqtsl4ymj4gtzlm"
    "7Hsi4xyfsix4fgtzy4ymj4bttiqfsi4wnij"
    "7Djfwnsl4bmnyj4ktw4Lfxyjwynij"
    "77Utb4tk4rd4ymwjjxhtwj4djfwx4fsi4yjs"
    "7Abjsyd4bnqq4sty4htrj4flfns"
    "7Hsi4yfpj4kwtr4xjajsyd4xuwnslx4f4xhtwj4"
    "7Py4qjfajx4rj4knkyd4rtwj"
    "77Hsi4xnshj4yt4qttp4fy4ymnslx4ns4gqttr"
    "7Mnkyd4xuwnslx4fwj4qnyyqj4wttr"
    "7Hgtzy4ymj4bttiqfsix4P4bnqq4lt"
    "7At4xjj4ymj4hmjwwd4mzsl4bnym4xstb77"
    char szPlain[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    \n1234567890?";
    char szCifer[] = "fghijklmnopqrstuvwxyzabcdeHIJKLMNOPQRSTUVWXYZABCDEFG47!@#$%^&
    char *cp = szPoem";
    for( ; *cp; ++cp ) {
    char p = strchr( szCifer, cp ) ;
    putchar( p ? szPlain[ p - szCifer ] : '~' );
    Lovliest of trees the cherry now
    Is hung with bloom along the bough
    And stands about the woodland ride
    Wearing white for Eastertide
    Now of my threescore years and ten
    Twenty will not come again
    And take from seventy springs a score
    It leaves me fifty more
    And since to look at things in bloom
    Fifty springs are little room
    About the woodlands I will go
    To see the cherry hung with snow
    thanking you,
    jane

    Your textbook should probably have info on iostreams, or try a google search http://www.google.com/search?hl=en&q=iostream+tutorial. You'll want to look at std::cout for displaying prompts, std::cin for reading the filename, and std::ifstream for reading from the file. If you have learned std::string, it would be better to learn to use std::getline(std::istream& strm, std::string& str), instead of std::istream::getline(...). That way so you won't have to worry so much about maximum line length.
    Josh Walker

  • Help with substitution decryption plz!!

    Hi there,
    I'm relatively new to developing with Java, and as a piece of work I have to decrypt a cipher text (which is quite long, near 11,500 characters) that has been encrypted with substitution and is in english.
    It consists of upper case letters, and some punctuation symbols, although whether they will actually function as punctuation i'm not sure; they seem to be just breaking the cipher into chunks of the alphabetic characters, and not in any uniform manner (eg every 12 characters). I did think maybe they'll be where spaces will need to go but that would be a little obvious, and some 'chunks' are too large for that to even make sense (over 50 characters). Maybe they're just a kind of wildcard to make it more complicated to analyse.
    As i understand it i need to use frequency tables_. I want to deduce the letters for those that have a unique frequency (to be sure i've not substituted with the wrong letter if/when there is a few to choose from at the frequency). I think i know how to do this;
    use 2d arrays-
    -- one for the frequency table i'll compare the cipher text against
    -- i have a few examples of these from the internet that i'll base it on,
    since i don't have a piece of the original plaintext to analyse.
    -- is there a better way to get the frequency for comparison? There is some variation in the tables i've managed to find so.
    -- another table for storing the analysis of the cipher text
    The dimensions will be the frequency, and the character.
    For the character, do I need to use ASCII representation? or would it be ok just using characters. Just figured i need to convert the ASCII back into characters to an output file is all. Is there an implemented way to do this conversion in Java easily? I've not had to work with it before so.
    Once i've done that part, I understand I need to use a wordlist_ to try and find words in what i've decrypted so far, and try to further the decryption with this also; ie if i find a word which adds new characters, add those new characters to the whole cipher. When finding words would i need to represent the cipher i'm working on with just the characters i have deduced, and say '_' as a character to represent one we don't yet have? eg if we had substituted B and T in, and the word being represented was 'better' would i need to hunt for words with a representation like this-> BETTE_ for example.
    Hope that bit made sense!!! lol.
    Also, i need to insert spaces where relevant (after a discovered word i suppose).
    This is the part that is most troubling me, any ideas of where to start?
    Firstly, i've not been able to find any wordlist's on the internet, know any sources? Is there a way i could use a dictionary stored on my computer elsewhere? say the dictionary from openOffice? I haven't worked with dictionaries or wordlists before so, any help with this part will greatly improve my understanding/progress.
    Is there an implemented way to do this any of this in Java easily? I'm using the Eclipse IDE just so you know.
    That's my thoughts and questions for the moment, might have more after i hear advice (sorry if it's rather long, just want to be clear).
    Hope you can help,
    Thanks in advance!
    ps. what is the text called you have when you have decrypted it? simply the decryption text? or just plaintext again? is there a term for when it's part way decrypted? like it's not the plaintext yet?

    H84ll1 wrote:
    anybody else out there had much experience with doing this kind of decrytion? I'm quite stuck on the worlist part, where can i get a good one!!? lol.lol. did you really try googling? this search
    http://www.google.com/search?q=wordlist&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
    produces this result:
    http://wordlist.sourceforge.net/
    Does anyone know if it's possible to use something already on the computer for the worlist/dictionary part?it looks like the link above will give you better lists
    >
    I really need help on this,
    anyone..?google

  • Help needed in Substitution & User Exit.

    Hi Experts,
    I have a peculiar recuirement. In the <b>Vendor Invoide Creation</b> transaction (<b>FB60</b>), if you try to create a Invoice/Credit memo for a "<b>One Time Vend</b>or", a pop up window comes asking Bank and Address data.
    The user need to enter the bank key and acc no and  need to substitute the name, address fields in this pop up window screen, with some data fetched from custom DB tables according to the bank keys.
    Since the pop up screen fields are from structure BSEC, I cant really do the substitution them from OBBH (Since it only allows BSEG & BKPF fields to be substituted !! ).
    Also since the Only user exit (ZXCPDU01) avaliable in FB60 does not have any Export table, I can send the values back to the screen.
    <b>Can any one of you by any luck have a feasible solution for this ?</b>

    hi Saurav.
    there are 14 user exits in thsi transaction. these are as follows
    F050S001            FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment
    F050S002            FIDCC1: Change IDoc/do not send
    F050S003            FIDCC2: Change IDoc/do not send
    F050S004            FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send
    F050S005            FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document
    F050S006            FI Outgoing IDoc: Reset Clearing in FI Document
    F050S007            FIDCCH Outbound: Influence on IDoc for Document Change
    F180A001            Balance Sheet Adjustment
    FARC0002            Additional Checks for Archiving MM Vendor Master Data
    FEDI0001            Function Exits for EDI in FI
    RFAVIS01            Customer Exit for Changing Payment Advice Segment Text
    RFEPOS00            Line item display: Checking of selection conditions
    RFKORIEX            Automatic correspondence
    SAPLF051            Workflow for FI (pre-capture, release for payment)
    check if anyone of them meets ur requiremnt
    regards
    ravish
    <b>plz dont forget to reward points if helpful</b>

  • Substitution not working - Help needed ASAP..

    Hi Gurus,
    We're trying to substitute the PersonListVO of Irecruitment>Candidates page> Individuals tab. We have imported the substitution successfully and deployed the classes and xml in the right directory. But the page is still referencing the original vo. below is the output statement of jdr_utils.printdocument. PLs help as we're near our deadline and we've run out of ideas. Thanks.
    <?xml version='1.0' encoding='UTF-8'?>
    <customization xmlns="http://xmlns.oracle.com/jrad" xmlns:ui="http://xmlns.oracle.com/uix/ui" xmlns:oa="http://xmlns.oracle.com/oa" xmlns:user="http://xmlns.oracle.com/user" version="9.0.3.8.13_1426" xml:lang="en-US"
    customizes="/oracle/apps/per/irc/candidateSearch/server/PersonListVO">
    <replace with="/fao/oracle/apps/per/irc/candidateSearch/server/FaoPersonListVO"/>
    </customization>

    Yes, we have already bounced the server many times and check the about this page if the substitution has been reflected even before we checked using jdr_utils.. But so far no luck. What I forgot to mention before is that the vo we are substituting is composed of 6 EO and we couldn't change the query using the expert mode, so we just added one of the columns from the EO..

Maybe you are looking for