Open Side Menu Go to the Top
Register
Programming homework and newbie help thread Programming homework and newbie help thread

01-30-2015 , 11:45 PM
ChrisV, daveT, and adios

Sorry for the delay in replying, I've been quite busy. Thank you all for the help, it is really appreciated!

ChrisV, it was I that screwed up the cipher text! I decrypted the original cipher text and saw that it had information about my university that I didn't want to post, so I replaced it. I think my efforts go to show that computers > humans when it comes to encrypting messages.

Cheers!
Programming homework and newbie help thread Quote
01-31-2015 , 12:11 AM
Quote:
Originally Posted by daveT

(to get the same result as ChrisV, you need to enter 23).


daveT,

That's interesting and strange. I don't understand why 23 is the value to successfully decrypt the cipher text instead of 3. How would I modify it to make it so a shift value of 3 successfully decrypts? I'm required to have 3 be the decrypting shift value.

Also, the assignment was originally instructed to be done in Java, and in the example my professor went over converting to ASCII in Java, but he also said we could use Python. I've tried running this code in Python3 after fixing the print syntax at the bottom and it fails with this error message. Any ideas?

Code:
cipherText = "FRQJUDWXODWLRKVBRXKDYHGHFOBSWHGWKHPHVVDJH"
shiftValue = input("Please enter an integer shift value from 1 to 26: ")

result = ""
for char in cipherText:
    result = result + chr(((ord(char) - 65 - shiftValue) % 26) + 65)  
print(result)
Quote:
Traceback (most recent call last):
File "C:\Users\IDC\Documents\Cryptography\CasesarCipher \TestFile.py", line 6, in <module>
result = result + chr(((ord(char) - 65 - shiftValue) % 26) + 65)
TypeError: unsupported operand type(s) for -: 'int' and 'str'

I have no idea what this means. And as an aside, I don't even want to ask what endianness is. I'm astounded at how easy some of you make programming look. It's tough in my opinion.
Programming homework and newbie help thread Quote
01-31-2015 , 12:36 AM
catsec, you should consider using a pencil and paper when you don't understand how an algorithm works. Stepping through it leads to understanding.

The error you are receiving is pretty straight-forward. You are trying to subtract an integer and a string, which even Python won't let you do.

Endianess isn't too mysterious. It is how the computer "reads" byte-code, reading either left-to-right or right-to-left.
Programming homework and newbie help thread Quote
01-31-2015 , 11:43 AM
Endianness

You will seldom have to be concerned about this. Perhaps when processing byte streams from an external source.
Programming homework and newbie help thread Quote
02-05-2015 , 07:44 AM
I have a problem in Visual Studio / C#:

We're working on building a movie Collection program, and I built a window, but something was wrong with the compability between it and the other stuff we'd built, so a group member told me to delete the repo-folder (my documents/source/repo) which I did, and cloned the repository we all share in VS...

However now I can't run the thing and I get this error:

"Visual Studio cannot start debugging because the debug target 'C:\Users\MyName\Source\Repos\GroupName\WindowsFor mApplication1\WindowsFormsApplication1\bin\Debug\F ilmApplication.exe' is missing. Please build the Project and retry, or set the OutputPath and AssemblyName properties appropriately to Point at the correct location for the target assembly"

I checked the Output path, and it's the same as for the others,\bin\debug\

Does anyone know how I can fix this, extremely irritating problem?

Thanks in advance,

nejo
Programming homework and newbie help thread Quote
02-05-2015 , 07:51 AM
Quote:
Originally Posted by nejo
I have a problem in Visual Studio / C#:

We're working on building a movie Collection program, and I built a window, but something was wrong with the compability between it and the other stuff we'd built, so a group member told me to delete the repo-folder (my documents/source/repo) which I did, and cloned the repository we all share in VS...

However now I can't run the thing and I get this error:

"Visual Studio cannot start debugging because the debug target 'C:\Users\MyName\Source\Repos\GroupName\WindowsFor mApplication1\WindowsFormsApplication1\bin\Debug\F ilmApplication.exe' is missing. Please build the Project and retry, or set the OutputPath and AssemblyName properties appropriately to Point at the correct location for the target assembly"

I checked the Output path, and it's the same as for the others,\bin\debug\

Does anyone know how I can fix this, extremely irritating problem?

Thanks in advance,

nejo
Solved. The problem was that there was an error in the code, and that prevented the program from running and creating an .exe-file. I just put /* */ around the problem-code and was able to run the program.
Programming homework and newbie help thread Quote
02-05-2015 , 08:24 AM
Hi all, I think I just realized something and wanted to make sure I was correct.

Am I correct in that a python program cannot possibly be closed source, as it is not compiled? Like for languages that must be compiled, when they are compiled into binary executable, you cannot read the source code without reverse engineering, and so such programs can be closed source if the producers choose to not publish the source code. This is not the case with python, so you cannot close source a python program.

Am I correct?
Programming homework and newbie help thread Quote
02-05-2015 , 09:02 AM
No. For instance, a python program can be executed via a webservice.
Programming homework and newbie help thread Quote
02-05-2015 , 02:25 PM
and there are packages which can turn your code into an executable binary
Programming homework and newbie help thread Quote
02-05-2015 , 10:22 PM
You can compile python to .pyc files, which certainly aren't human readable.
Programming homework and newbie help thread Quote
02-06-2015 , 01:55 AM
Rats! Even though I knew those things, I failed to consider them. Thanks all!
Programming homework and newbie help thread Quote
02-06-2015 , 12:27 PM
I thought you could decompile most languages back to their original code? At least in the case of Java and Python, which is why on android for instance (which is written in java) your code is run through a program that obfuscates it, which while not making it impossible to get the original code, makes it harder. I also thought Python was supposed to be relatively easy to reverse engineer? Is that not correct, or am I totally misunderstanding what you guys mean
Programming homework and newbie help thread Quote
02-06-2015 , 11:15 PM
A .jar file is really a .zip file. You can "decompile" a .jar file using 7zip, which gives you clean source and folder tree back.

It seems kind of a given that if you can compile to something, you can decompile.

first hit for "decompile python" http://stackoverflow.com/questions/8...python-2-7-pyc
Programming homework and newbie help thread Quote
02-07-2015 , 01:19 AM
Quote:
Originally Posted by daveT
A .jar file is really a .zip file. You can "decompile" a .jar file using 7zip, which gives you clean source and folder tree back.

It seems kind of a given that if you can compile to something, you can decompile.

first hit for "decompile python" http://stackoverflow.com/questions/8...python-2-7-pyc
I have my doubts about optimized C and C++ code.
Programming homework and newbie help thread Quote
02-08-2015 , 12:15 PM
highly recommend going through this if anyone is interested in data analysis/manipulation: https://www.youtube.com/watch?v=w26x-z-BdWQ
Programming homework and newbie help thread Quote
02-11-2015 , 06:01 AM
following a quick guide to get acquainted with Powershell, and for some reason i can't get the "less" and "more" commands to work (using Windows 7).

i save a text file (ex13.txt) to C:\Users\Myname\temp\

type "less ex13.txt" but get the error

Quote:
The term 'less' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
ng of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ less <<<< ex13.txt
+ CategoryInfo : ObjectNotFound: (less:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
well, idk what that's all about :S i tried it both as empty text file and with some words although i think that shouldn't matter.
Programming homework and newbie help thread Quote
02-11-2015 , 09:34 AM
Quote:
Originally Posted by TheHoss
following a quick guide to get acquainted with Powershell, and for some reason i can't get the "less" and "more" commands to work (using Windows 7).

i save a text file (ex13.txt) to C:\Users\Myname\temp\

type "less ex13.txt" but get the error



well, idk what that's all about :S i tried it both as empty text file and with some words although i think that shouldn't matter.
Not a Powershell expert. Looked at your guide and it appears that it lists Unix commands that are implemented with Powershell aliases. I'm guessing that less doesn't have a Powershell alias.
Programming homework and newbie help thread Quote
02-11-2015 , 12:00 PM
less and more work in powershell. That said I have no idea why you are getting that error.
Programming homework and newbie help thread Quote
02-11-2015 , 03:01 PM
hi, i'm supposed to do this in python

a).Write a function that takes input a,b,c and finds the solution to a^x=b(mod c)
b). use the function u wrote in part a to solve 34091202317940^x = 46461034929471 (mod 61704897745301)

i tried just doing it iteratively by simply doing accumulator*a n times until accumulator = b(mod c) then returning n, however this function overflows for part b, since the numbers are just too big, so i was wondering is there a smarter way to do this?(perhaps some theorem that i need to use?)
Programming homework and newbie help thread Quote
02-11-2015 , 09:19 PM
Quote:
Originally Posted by CyberShark93
hi, i'm supposed to do this in python

a).Write a function that takes input a,b,c and finds the solution to a^x=b(mod c)
b). use the function u wrote in part a to solve 34091202317940^x = 46461034929471 (mod 61704897745301)

i tried just doing it iteratively by simply doing accumulator*a n times until accumulator = b(mod c) then returning n, however this function overflows for part b, since the numbers are just too big, so i was wondering is there a smarter way to do this?(perhaps some theorem that i need to use?)
I assume you are Python 2.7. The number is greater than 32 bits. Not an expert on Python, just a guess. If so start from there.
Programming homework and newbie help thread Quote
02-11-2015 , 09:39 PM
Quote:
Originally Posted by adios
I assume you are Python 2.7. The number is greater than 32 bits. Not an expert on Python, just a guess. If so start from there.
i managed to solve the overflow problem, but i found out that doing it iteratively is simply too slow for large inputs, i was wondering if there is a way where i can be clever and skip over a lot of cases where i don't need to test?
Programming homework and newbie help thread Quote
02-11-2015 , 10:08 PM
Quote:
Originally Posted by CyberShark93
hi, i'm supposed to do this in python

a).Write a function that takes input a,b,c and finds the solution to a^x=b(mod c)
b). use the function u wrote in part a to solve 34091202317940^x = 46461034929471 (mod 61704897745301)

i tried just doing it iteratively by simply doing accumulator*a n times until accumulator = b(mod c) then returning n, however this function overflows for part b, since the numbers are just too big, so i was wondering is there a smarter way to do this?(perhaps some theorem that i need to use?)
have you tried taking logs of both sides?
Programming homework and newbie help thread Quote
02-11-2015 , 10:39 PM
Quote:
Originally Posted by econophile
have you tried taking logs of both sides?
i think we require integer solutions to the congruence a^x = b (mod c)
taking log will give us the solution to a^x=b, however x is not necessarily an integer in that case
Programming homework and newbie help thread Quote
02-11-2015 , 10:44 PM
I think I remember a project euler problem like this, sadly Id learn how to do something like this and now I completely forget all the number theory stuff I learned to do them
Programming homework and newbie help thread Quote
02-12-2015 , 12:35 AM
Quote:
Originally Posted by CyberShark93
i managed to solve the overflow problem, but i found out that doing it iteratively is simply too slow for large inputs, i was wondering if there is a way where i can be clever and skip over a lot of cases where i don't need to test?
You could probably use successive approximation.
Programming homework and newbie help thread Quote

      
m