Padding methods for block ciphers - PKCS7 vs ANSI X.923 I was looking through block cipher padding methods, and found two good candidates:


ANSI X.923 - pad with zeros, then a final byte for the padding length, e.g. 00 00 00 04.
PKCS7 - pad with bytes that each show the number of padding bytes, e.g. 04 04 04 04.


Is there any benefit to using PKCS7 over ANSI X.923 padding, or vice versa?
This site is a reference for padding:

http://www.di-mgt.com.au/cryptopad.html

Method 3 refers to the ANSI X.923 and method 1 refers to PKCS7.

The main advantage listed is that PKCS7 allows you to double check the number of padding bytes