While a folder is ready to be compressed as RAR archive, a password can be set at the same time to lock RAR file.
RAR is a usual file format usually used to reduce the file size and improve transfer speed. How to Lock and Unlock a Password Protected RAR File