Need some help with decrypt key

Hi all,
Working on a homework assignment but stuck with a little bit of coding. Anybody who’s willing to help me or point me to the right direction.

Assignment is to translate a python script to a ruby script.
First the python script :

my_secret_key = 5
def decrypt ( secret_string , secret_number ) :
result = “”
for x in secret_string :
result = result+chr( ord ( x ) ^ int (secret_number) )
return result

print(my_secret_key, “is my secret key”)

print(decrypt(“alq%lv%``k%bmlh” , my_secret_key ) )
print(“is my secret prhase”)

Now what i got so far with the Ruby script

my_secret_key = 5
def decrypt ( secret_string , secret_number )
result = “”
secret_string.each do |x|
result = result+chr{ ord ( x ) ^ int {secret_number} }
end
return result
end

puts(my_secret_key,“is my secret key”)

puts(decrypt(“alq%lv%``k%bmlh” , my_secret_key ) )
puts(“is my secret phrase”)

I’m stuck at the decrypt key.

Please can somenone help me

Thank you

Chris

And… Did you figure this out? Out of curiousity and a ruby beginner as well, what was the solution

Unfortunattly not. Also getting no help or reply’s from the community so still stuck :frowning:
When i have the sollution ill post it here

1 Like

Hopefully i bumped the topic a bit so it shows up at the of the list once more . Good luck there mate

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs