🏠 返回首頁 

Greasy Fork is available in English.

Русский шифратор 2905 года обновлённый 2.0

Шифратор на русском языке

// ==UserScript==// ==UserScript==
// @name         Русский шифратор 2905 года обновлённый 2.0
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Шифратор на русском языке
// @match        *://*/*
// @grant        none
// ==/UserScript==
(function() {
'use strict';
// Функция для смещения букв
function shiftChar(char, shift) {
const unicode = char.charCodeAt(0);
if (unicode >= 1072 && unicode <= 1103) { // Проверка на буквы русского алфавита
return String.fromCharCode(((unicode - 1072 + shift + 32) % 32) + 1072);
}
return char; // Возвращаем символ без изменений, если не русский
}
// Функция для шифрования
function encrypt(text) {
const words = text.split(' ').map(word => {
let shifted = '';
for (const char of word) {
shifted += shiftChar(char, 5); // Смещение +5
}
shifted = shifted.split('').reverse().join('');
return shifted;
});
return words.join(' ');
}
// Функция для дешифрования
function decrypt(text) {
const words = text.split(' ').map(word => {
let shifted = '';
for (const char of word) {
shifted += shiftChar(char, -5); // Смещение -5
}
shifted = shifted.split('').reverse().join('');
return shifted;
});
return words.join(' ');
}
// Создаем простой интерфейс
const container = document.createElement('div');
container.style.position = 'fixed';
container.style.top = '290px';
container.style.right = '10px';
container.style.backgroundColor = 'white';
container.style.border = '1px solid black';
container.style.zIndex = '1000';
container.style.padding = '20px';
const textArea = document.createElement('textarea');
textArea.placeholder = "Введите текст для шифрования...";
textArea.style.width = '240px';
textArea.style.height = '200px';
container.appendChild(textArea);
const encryptButton = document.createElement('button');
encryptButton.innerText = 'Зашифровать';
encryptButton.onclick = function() {
const r###lt = encrypt(textArea.value);
r###ltArea.value = r###lt; // Отображаем результат в результат-области
navigator.clipboard.writeText(r###lt).then(() => {
alert('Зашифрованный текст скопирован в буфер обмена!');
});
};
container.appendChild(encryptButton);
const decryptButton = document.createElement('button');
decryptButton.innerText = 'Расшифровать';
decryptButton.onclick = function() {
const r###lt = decrypt(textArea.value);
r###ltArea.value = r###lt; // Отображаем результат в результат-области
navigator.clipboard.writeText(r###lt).then(() => {
alert('Расшифрованный текст скопирован в буфер обмена!');
});
};
container.appendChild(decryptButton);
const r###ltArea = document.createElement('textarea');
r###ltArea.placeholder = "Результат шифрования...";
r###ltArea.style.width = '240px';
r###ltArea.style.height = '200px';
r###ltArea.readOnly = true;
container.appendChild(r###ltArea);
document.body.appendChild(container);
})();
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      2025-01-05
// @description  try to take over the world!
// @author       You
// @match        http://*/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
})();