People find encryption in their scripts hard. With this action plugin, It's easy. It contains 3 different catergorys.
- FileEncrypt
- RegistryEncrypt
- StringEncrypt
For some reason, when put in the _notification_messages.lua, It doesnt work. So stick it in On Preload or something.
Files included, Have a nice day.Code:FileEncrypt = {}; RegistryEncrypt = {}; StringEncrypt = {}; function FileEncrypt.WriteFromString(sFile, sKey, sText) if (sFile == "" or sFile == nil) then error("FileEncrypt.WriteFromString: No file specified."); end if (sKey == "" or sKey == nil) then error("FileEncrypt.WriteFromString: No key specified."); end if (sText == "" or sText == nil) then error("FileEncrypt.WriteFromString: Text not specified."); end TextFile.WriteFromString(sFile, Crypto.BlowfishEncryptString(sText, sKey, 0), false); end function FileEncrypt.WriteFromTable(sFile, sKey, tText) if (sFile == "" or sFile == nil) then error("FileEncrypt.WriteFromTable: No file specified."); end if (sKey == "" or sKey == nil) then error("FileEncrypt.WriteFromTable: No key specified."); end if (type(tText) ~= "table") then error("FileEncrypt.WriteFromTable: Text not specified."); end TextFile.WriteFromString(sFile, Crypto.BlowfishEncryptString(Table.Concat(tText, "\r\n", 1, -1), sKey, 0), false); end function FileEncrypt.ReadToString(sFile, sKey) if (sFile == "" or sFile == nil) then error("FileEncrypt.ReadToString: No file specified."); end if (sKey == "" or sKey == nil) then error("FileEncrypt.ReadToString: No key specified."); end return Crypto.BlowfishDecryptString(TextFile.ReadToString(sFile), sKey) end function FileEncrypt.GetEncryptedString(sFile) if (File.DoesExist(sFile)) then return TextFile.ReadToString(sFile); end end function FileEncrypt.GetEncryptedTable(sFile) if (File.DoesExist(sFile)) then return TextFile.ReadToTable(sFile); end end function RegistryEncrypt.WriteValue(sMainKey, sSubkey, sValue, sData, sType, sEncryptionKey) if (sMainKey and sSubkey and sValue and sData and sType and sEncryptionKey) then Registry.SetValue(sMainKey, sSubkey, sValue, Crypto.BlowfishEncryptString(sData, sEncryptionKey, 0), sType); end end function RegistryEncrypt.ReadValue(sMainKey, sSubkey, sValue, sDecryptionKey) if (sMainKey and sSubkey and sValue and sDecryptionKey) then return Crypto.BlowfishDecryptString(Registry.GetValue(sMainKey, sSubkey, sValue, bAutoExpand), sDecryptionKey) end end function StringEncrypt.EncryptString(sText, sKey) if (sText and sKey) then return Crypto.BlowfishEncryptString(sText, sKey, 0); end end function StringEncrypt.DecryptString(sText, sKey) if (sText and sKey) then return Crypto.BlowfishDecryptString(sText, sKey); end end

Reply With Quote


