Is this algorithm of constant time?
Under the assumptions you've stated, yes, the code runs in constant time.  The running time for any string can't be longer than the running time for a 128-character string, which is some constant number of steps.