Posts

Showing posts from April 4, 2019

How to set if else for vim's “set background = ” for light and dark colorschemes?

Image
1 For themes like One or PaperColor, there are dark and light versions. For dark or light theme, I usually add my own customizations like bracket color, comment color... etc. I tried to combine them so that everytime I set background=dark or light, with an if else statement. I tried the following but it doesn't work. if (set background=dark) """ my own code here endif Please let me know how to go about this and thank you. vimrc colorscheme share | improve this question asked 3 hours ago mle0312 mle0312 29 4

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

Image
6 3 $begingroup$ 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. sha1 is weak 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: https://stackoverflow.com/questions/3451670/java-aes-and-using-my-own-key https://howtodoinjava.com/security/java-aes-encryption-example/ https://blog.axxg.de/java-aes-verschluesselung-mit-beispiel/ encryption hash aes