lib/prawn/security/arcfour.rb in prawn-2.4.0 vs lib/prawn/security/arcfour.rb in prawn-2.5.0

- old
+ new

@@ -4,14 +4,10 @@ # as described at: # http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt # # "RC4" is a trademark of RSA Data Security, Inc. # -# Copyright August 2009, Brad Ediger. All Rights Reserved. -# -# This is free software. Please see the LICENSE and COPYING files for details. - # @private class Arcfour def initialize(key) # Convert string key to Array of integers key = key.unpack('c*') if key.is_a?(String) @@ -36,9 +32,13 @@ end @i = @j = 0 end + # Encrypt string. + # + # @param string [String] + # @return [String] def encrypt(string) string.unpack('c*').map { |byte| byte ^ key_byte }.pack('c*') end private