Cryptology Script Help

Discussion in 'Mac Programming' started by hochresmos, Apr 20, 2006.

  1. hochresmos
    Expand Collapse
    macrumors newbie


    Apr 20, 2006
    Ancient History
    I'm currently a college student taking a Cryptology course just making the jump from Windows to Mac, and I was looking for a way to automate some of the repetitive tasks necessary for RSA encryption. I have some Applescript experience, but I cannot manage to get anything to work. Any help would be incredibly well received.

    (Mathematical Explanation)

    The cryptology programs I need to automate are all executables and are used through terminal. RSA encryption uses a very simple equation: a^k mod n [where "a" is your message converted to numeric form (a=01, b=02,...), "k" is your public exponent (a number anyone can see) and "n" is a public modulus ("mod" is a function producing a quotient's remainder: 12 mod 5=2, 13 mod 5=3...)]. Encryption is attained through a multiplicative inverse ("d") of you public exponent, which is secret: thus a decryption formula of z^d mod n [where "z" is the encrypted numerical plaintext, "d" is the multiplicative inverse of "e," and "n" is the same modulus as above].

    [more info:]

    So, I know that Applescript can easily perform this type of math in its own interface, but I would much rather be able to create a script that would automatically 1) open a saved terminal session 2) open a certain textedit document 3) copy the first line of that textedit document 4) paste that line of text into terminal without executing the line 5) copy the second line of the textedit document 6) paste that line into terminal with a preceding space without executing the command 7) copy and paste the third line into terminal with a preceding space 8) execute the command line 9) close the textedit application leaving terminal as the active window.

    My main problem is that I cannot get textedit to copy anything to the clipboard, I can only get it to copy blocks of text within a document with the "duplicate to" command. Also, terminal refuses to accept any pasted data (from other programs) without executing the line. Again, any help with any of the steps listed above would be greatly appreciated.
  2. kainjow
    Expand Collapse
    Moderator emeritus


    Jun 15, 2000
    OpenSSL does encryption stuff. It's built-in to OS X.

    And what you're wanting to do with the terminal and text edit is called shell scripting. Google it :)
  3. superbovine
    Expand Collapse
    macrumors 68030


    Nov 7, 2003
    *cough cough* and perl...

Share This Page