Skip to main content

AES: Why is it a good practice to use only the first 16bytes16 bytes of a hash for encryption?

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user pwpassword with sha1 and take only the first 16bytes16 bytes.

But I don't think this can be a good praticepractice.

  1. sha1 is weak
  2. taking only the first 16bytes16 bytes makes the hash also weak and rise the chance for a collision (even with sha-256)

Is this really the best practice? Why? How can I do things better?

Some links to the articles I mentioned:

AES: Why is it a good practice to use only the first 16bytes of a hash for encryption?

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user pw with sha1 and take only the first 16bytes.

But I don't think this can be a good pratice.

  1. sha1 is weak
  2. taking only the first 16bytes makes the hash also weak and rise the chance for a collision (even with sha-256)

Is this really the best practice? Why? How can I do things better?

Some links to the articles I mentioned:

AES: Why is it a good practice to use only the first 16 bytes of a hash for encryption?

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user password with sha1 and take only the first 16 bytes.

But I don't think this can be a good practice.

  1. sha1 is weak
  2. taking only the first 16 bytes makes the hash also weak and rise the chance for a collision (even with sha-256)

Is this really the best practice? Why? How can I do things better?

Some links to the articles I mentioned:

Tweeted twitter.com/StackCrypto/status/1113954477814505472
Became Hot Network Question
added 260 characters in body
Source Link

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user pw with sha1 and take only the first 16bytes.

But I don't think this can be a good pratice.

  1. sha1 is weak
  2. taking only the first 16bytes makes the hash also weak and rise the chance for a collision (even with sha-256)

sha1 is weak taking only the first 16bytes makes the hash also weak and rise the chance for a collision (even with sha-256) IsIs this really the best practice? Why? How can I do things better?

Some links to the articles I mentioned:

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user pw with sha1 and take only the first 16bytes.

But I don't think this can be a good pratice.

sha1 is weak taking only the first 16bytes makes the hash also weak and rise the chance for a collision (even with sha-256) Is this really the best practice? Why? How can I do things better?

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user pw with sha1 and take only the first 16bytes.

But I don't think this can be a good pratice.

  1. sha1 is weak
  2. taking only the first 16bytes makes the hash also weak and rise the chance for a collision (even with sha-256)

Is this really the best practice? Why? How can I do things better?

Some links to the articles I mentioned:

Source Link

AES: Why is it a good practice to use only the first 16bytes of a hash for encryption?

I'd like to encrypt Text with AES/CTR and a password defined by the user in java. I already checked the internet (and stackoverflow) for answers. The most used version is to hash the user pw with sha1 and take only the first 16bytes.

But I don't think this can be a good pratice.

sha1 is weak taking only the first 16bytes makes the hash also weak and rise the chance for a collision (even with sha-256) Is this really the best practice? Why? How can I do things better?