Implement a secure way to encrypt a string using a HMAC with either a SHA256 or SHA512 hash. Use 3DES, AES128 and AES256 algorithms in CBC mode.