Scan-based side channel attack on stream ciphers and its prevention