implemented bit rotate algorithm