hamming S3 method