-
Notifications
You must be signed in to change notification settings - Fork 8
Сравнение файлов через SHA1 #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
// | ||
Функция ПолучитьСуммуФайлаSHA1(ПутьКФайлу) Экспорт | ||
|
||
Если НЕ ФайлСуществует(ПутьКФайлу) Тогда |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
съехало форматирование
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
пустая строка мешает? Просто по файлу везде так сделано. Повторял увиденное, что было однообразно)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В односкрипте есть встроенные функции хеширования. https://oscript.io/syntax/page/%D0%A5%D0%B5%D1%88%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%D0%94%D0%B0%D0%BD%D0%BD%D1%8B%D1%85
Будет кроссплатформенно и на маке должно работать
Ответ = Команда.ПолучитьВывод(); | ||
Возврат СокрЛП(СтрПолучитьСтроку(СтрЗаменить(Ответ, " ", ""), 2)); | ||
Иначе | ||
Команда.УстановитьКоманду("sha1sum"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А на macOs так же?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У меня нету мака. Не могу проверить(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
@@ -3,4 +3,5 @@ | |||
.Версия("1.0.0") | |||
.ВключитьФайл("Модули") | |||
.ВключитьФайл("LICENSE") | |||
.ВключитьФайл("README.md"); | |||
.ВключитьФайл("README.md") | |||
.ЗависитОт("1commands", "1.5.0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ФС - это "базовая" либа. Её стоит держать без зависимостей чтобы избежать неразрешимых циклов. Например, 1скоммандс больше не сможет использовать ФС, так как ФС будет зависеть от него
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это придется тащить методы из 1commands по работе с процессами( а там много чего и будут дубли кода. Вот думаю как обойти. на ум приходит только сделать отдельную библиотеку по работе с хеш-суммами.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Методы 1коммандс не нужны, в оскрипте есть встроенные средства получения SHA1
Закрываю ПР, т.к. @EvilBeaver уже писал, что в движке есть встроенные методы хеширования |
Нене, сам метод-то хороший, просто реализация немного не та. Я не вижу ничего плохого в helper-методе для сравнения по хешам |
ФС.ПолучитьСуммуФайлаSHA1(ПутьКФайлу)
- Вычиcлсяет значение хеш-суммы (контрольной суммы) для указанного файлов по алгоритму SHA-1.ФС.СравнитьФайлы(ПервыйФайл, ВторойФайл)
- Сравнивает хеш-суммы 2-х переданных файлов