文本文件使用Vi 加密碼提示Using a weak encryption method;

vi/vim 能夠給文件加密碼,即在打開時會提示輸入密碼,輸入錯誤的密碼則會打開亂碼;具體操做爲:使用vi打開須要加密的文件後,在命令模式下(即正常模式)輸入 :X 回車,提示輸入密碼(需輸入兩次密碼)後,保存退出(沒保存退出加密不生效)。vim

在默認狀況下輸入:X時會提示Warning: Using a weak encryption method; see :help 'cm',解決辦法是把默認的zip加密模式改爲blowfish或者blowfish2,具體以下:ui

:setlocal cm?              " show encryption method for the current file
:setlocal cm=zip           " weak (default for backwards-compatibility)
:setlocal cm=blowfish      " better
:setlocal cm=blowfish2     " best (requires Vim version 7.4.399 or higher)
相關文章
相關標籤/搜索