<commit_before>require 'digest/sha1'

module WebSocket
  class ClientHandshake < Http::Request

    def self.accept_token_for(websocket_key)
      Digest::SHA1.base64digest(websocket_key.strip + GUID)
    end

    def errors
      @errors ||= []
    end

    def valid?
      if headers['Connection'].downcase != 'upgrade'
        errors << 'Not connection upgrade'<commit_msg>Not use Digest::SHA1#base64digest since it is not in Rubinius<commit_after>require 'digest/sha1'
require 'base64'

module WebSocket
  class ClientHandshake < Http::Request

    def self.accept_token_for(websocket_key)
      Base64.encode64(Digest::SHA1.digest(websocket_key.strip + GUID)).strip
    end

    def errors
      @errors ||= []
    end

    def valid?
      if headers['Connection'].downcase != 'upgrade'
        errors << 'Not connection upgrade'
{'fraction_non_alphanumeric': 0.10406698564593302, 'fraction_numerical': 0.017942583732057416, 'mean_word_length': 3.4759358288770055, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2866459', 'n_tokens_mistral': 276, 'n_tokens_neox': 253, 'n_words': 59}