You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: redis-sha1.rb
    path of file: ./repos/codis/extern/deprecated/redis-3.2.4/utils
    
    the code of the file until where you have to start completion: # redis-sha1.rb - Copyright (C) 2009 Salvatore Sanfilippo
# BSD license, See the COPYING file for more information.
#
# Performs the SHA1 sum of the whole datset.
# This is useful to spot bugs in persistence related code and to make sure
# Slaves and Masters are in SYNC.
#
# If you hack this code make
    
def redisSha1(opts={})
    sha1=""
    r = Redis.new(opts)
    r.keys('*').sort.each{|k|
        vtype = r.type?(k)
        if vtype == "string"
            len = 1
            sha1 = Digest::SHA1.hexdigest(sha1+k)
            sha1 = Digest::SHA1.hexdigest(sha1+r.get(k))
        elsif vtype == "list"
            len = r.llen(k)
            if len != 0
                sha1 = Digest::SHA1.hexdigest(sha1+k)
                sha1 = Digest::SHA1.hexdigest(sha1+r.list_range(k,0,-1).join("\x01"))
            end