[encrption]added some modifications to the ld calculation.