Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make sure we lowercase before hashing and hash correctly

  • Loading branch information...
commit 4916809c32e82ab15d11c92133fdda96946623f7 1 parent 12a32ad
@seancarr seancarr authored
View
2  perl/RapleafApi.pl
@@ -29,7 +29,7 @@ sub query_by_email {
my $hash_email = $_[1] || undef;
if (defined($hash_email)) {
my $s = Digest::SHA1 -> new;
- $s -> add($email);
+ $s -> add($email -> lc);
query_by_email($s -> hexdigest);
} else {
my $url = 'https://personalize.rapleaf.com/v4/dr?api_key=' . $API_KEY . '&email=' . uri_escape($email);
View
2  php/RapleafApi.php
@@ -30,7 +30,7 @@ function query_by_email($email, $hash_email = false) {
* If the hash_email option is set, then the email will be hashed before it's sent to Rapleaf
*/
if ($hash_email) {
- $sha1_email = sha1($email);
+ $sha1_email = sha1(strtolower($email));
return query_by_sha1($sha1_email);
} else {
$url = RAPLEAF_BASE_PATH . "&email=" . urlencode($email);
View
2  php5/RapleafApi.php
@@ -39,7 +39,7 @@ function query_by_email($email, $hash_email = false) {
* If the hash_email option is set, then the email will be hashed before it's sent to Rapleaf
*/
if ($hash_email) {
- $sha1_email = sha1($email);
+ $sha1_email = sha1(strtolower($email));
return self::query_by_sha1($sha1_email);
} else {
$url = self::$BASE_PATH . self::$API_KEY . "&email=" . urlencode($email);
View
4 python/RapleafApi.py
@@ -35,8 +35,8 @@ def query_by_email(self, email, hash_email = False):
"""
if hash_email:
s = hashlib.sha1()
- s.update(email)
- return self.query_by_sha1(s.digest())
+ s.update(email.lower())
+ return self.query_by_sha1(s.hexdigest())
url = '%s&email=%s' % (RapleafApi.basePath, urllib.quote(email))
return self.__get_json_response(url)
View
2  ruby/RapleafApi.rb
@@ -42,7 +42,7 @@ def initialize(api_key, options = {})
# account is not subscribed to but for which Rapleaf has data
def query_by_email(email, options = {})
if options[:hash_email]
- query_by_sha1(Digest::SHA1.hexdigest(email), :show_available => options[:show_available])
+ query_by_sha1(Digest::SHA1.hexdigest(email.downcase), :show_available => options[:show_available])
else
get_json_response("#{@BASE_PATH}&email=#{url_encode(email)}", options[:show_available])
end
Please sign in to comment.
Something went wrong with that request. Please try again.