Touché On 23/06/2012, at 7:19 PM, markbrown4 wrote:
> Nah, it's not the power operator. > http://en.wikibooks.org/wiki/JavaScript/Operators > > Clifford was right, it's a bitwise xor operator. > > On Saturday, 23 June 2012 17:22:03 UTC+10, Ivan Vanderbyl wrote: > Isn't hat simply power operator? The ruby equiv should be ** > > Regards, > Ivan Vanderbyl > > Sent from my iPhone > > On 23/06/2012, at 4:42 PM, markbrown4 <[email protected]> wrote: > >> Thanks guys, >> >> I realise that the javascript function I posted is just shifting the >> characters and isn't real encryption. >> All I was looking for was a simple way to mask the data being sent to the >> server. >> >> I had a quick look for what the ^ operator does in Javascript but couldn't >> find any info on it. >> The ^ operator isn't available in Ruby 1.9.3 so I don't know what the Ruby >> equivalent would look like. >> >> Cryptocat looks interesting but I couldn't find any good examples, AES looks >> like it could work. >> http://www.movable-type.co.uk/scripts/aes.html >> >> >> Cheers, >> >> On Friday, 22 June 2012 23:02:06 UTC+10, Clifford Heath wrote: >> On 22/06/2012, at 5:54 PM, Mark Brown wrote: >> > I know trying to secure anything on the client-side is a no-no. >> > >> > function crypt(text, key) { >> > var result = ""; >> > for(var i=0, ii=text.length; i<ii; ++i) { >> > result += String.fromCharCode(key^text.charCodeAt(i)); >> > } >> > return result; >> > } >> > >> > crypt('{ data: "yep" }', 6) => "}&bgrg<&$ cv$&{" >> > crypt("}&bgrg<&$ cv$&{", 6) => { data: "yep" } >> > >> > Can anyone help with a Ruby equivalent? to decrypt that string? >> > Or does anyone have other examples of client-side encryption and >> > decryption in Ruby? >> >> That code doesn't do encryption - it's just a byte-wise xor mask. >> The Ruby equivalent is trivial. >> >> In regard to encryption on the client side, the client should be regarded >> as an untrusted third party. It must prove its authenticity in *every* >> transaction, >> by a signature applied over the entire message content. The signature may >> be constructed using a shared secret or by use of a private key. >> >> Clifford Heath. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby or Rails Oceania" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rails-oceania/-/pJMXcWw0LQUJ. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/rails-oceania?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rails-oceania/-/sqN_fEJh1REJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
