Redis' sha1 is the result of hashing the string *without* a trailing newline.
The command-line sha1 is the result of hashing the string *with* a
trailing newline.
Both use \n as new lines.
I don't know if this is because Redis strips the trailing newline, or
whether your client does.
Regards,
- Josiah
On Tue, Aug 28, 2012 at 1:47 AM, Kaan Ozdokmeci <
ka...@solidict.com> wrote:
> Hi,
>
> After I load my script the sha1 digest I receive is different from the one I
> obtain on the commandline
> by using sha1sum.
>
> sha1 by redis: bd8d94deaa1113ee0c1beae00bab6de0cc88be89
> output of sha1sum: 1e89c0d7552a4185839bf075da24a25914a8af41
> (openssl dgst -sha1 also outputs the same result sha1sum outputs)
>
> script:
>
> local key = KEYS[1]
> local desired_size = tonumber(ARGV[1])
> local member_controller = {}
> local member_controller_count = 0
> local final_set = {}
> local setSize = tonumber(redis.call('scard',key))
>
> if setSize <= desired_size then
> final_set = redis.call('smembers',key)
> else
> repeat
> local candidate = redis.call('srandmember',key)
> if not member_controller[candidate] then
> member_controller[candidate] = true
> member_controller_count = member_controller_count + 1
> end
> until member_controller_count == desired_size
> for k,_ in pairs(member_controller) do final_set[#final_set+1] = k end
> end
>
> return final_set
>
>
> I am using redis-2.6.0-rc6 and ubuntu 12.04LTS (64bit) if that helps :)
>
> What might be the reason for this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/redis-db/-/IWk5zCQJBfYJ.
> To post to this group, send email to
redi...@googlegroups.com.
> To unsubscribe from this group, send email to
>
redis-db+u...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/redis-db?hl=en.