Archived Forum Post

Index of archived forum posts

Question:

Inconsistency in CkCrypt2:HashFinalENC (ObjC vs. Python)

Jun 15 '13 at 09:21

I'm using the following code to compute a hashcode for a set of strings in Objective-C:

    [crypt HashBeginString: array[0]];
    for (int i = 1; i < array.count; i++)
        [crypt HashMoreString: array[i]];
    NSString *hashcode = [crypt HashFinalENC];

Working fine.

I'm also trying to compute the same hashcode for comparison in Python, using the following code:

    crypt.HashBeginString(array[0])
    for i in range(1, len(array)):
        crypt.HashMoreString(array[i])
    hashcode = crypt.HashFinalENC()

...which raises an error:

    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/chilkat.py", line 2553, in HashFinalENC
    def HashFinalENC(self, *args): return _chilkat.CkCrypt2_HashFinalENC(self, *args)
    TypeError: CkCrypt2_HashFinalENC() takes exactly 2 arguments (1 given)

Two arguments? I know that the object is implicitly passed as the the first argument, but why is it asking for a second one?

This seems inconsistent with both the ObjC version and the Python documentation for this function. I can't find any Python sample to indicate what I should be providing, and Python not being my language of choice, I can't figure out it wants.

Any suggestions?