Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > pl.comp.lang.javascript > #3480

Re: Hashing library

From Roman Tyczka <noemail@because.no>
Newsgroups pl.comp.lang.javascript
Subject Re: Hashing library
Date 2018-08-06 14:41 +0200
Organization ATMAN - ATM S.A.
Message-ID <k8rs0fgtbu7s$.dlg@tyczka.com> (permalink)
References <ja6kj9pynkt3$.dlg@tyczka.com> <8nfcmbsbq719.48va3s5uolyi$.dlg@40tude.net> <1xbx91tfkrzcf.dlg@tyczka.com> <1291u9tu6p6uq.1ihbayc0y8bmw.dlg@40tude.net>

Show all headers | View raw


On Fri, 3 Aug 2018 19:57:30 +0200, Borys Pogoreło wrote:

>> Jeszcze tylko dopytam, przy IE piszą, że od wersji 11 (czyli to co jest w
>> Win10), co z Win7, 8 i Vistą?
> 
> IE11 chyba jest też na W7, na W8 na pewno.
> 
> Jeszcze znalazłem coś takiego:
> https://github.com/vibornoff/webcrypto-shim
> 
> Co do base64, to witamy w świecie javascriptu, gdzie zaczyna się cyrk, gdy
> w grę wchodzą dane binarne:
> https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem


Nim jeszcze dotarłem do base64 już się odbiłem od crypto.

Zrobiłem sobie metodę:

	SHA512 : function (str) {
		var buffer = new TextEncoder("utf-8").encode(str);
		var hash = crypto.subtle.digest("SHA-512", buffer);
		return Array.from(new Uint8Array(hash));
	},

i ona po prostu nie działa, zwraca pustą tablicę.
W ostatniej linii konwertuje na tablicę bajtów obiekt jaki zwraca metoda
digest(). Ale z nim coś jest nie teges, debuger pokazuje, że ma dwa
propertysy PromiseStatus: pending i PromiseValue : undefined.
Wyczytałem, że to jakieś proxy dla wartości wyliczanej asynchronicznie.
Skoro pending to coś się nie skończyło. Ale nie mam pojęcia jak z tego
wybrnąć.

Co robię nie tak?

ps. znalazłem jeszcze taki przykład:

https://gist.github.com/chrisveness/e5a07769d06ed02a2587df16742d3fdd

i w komentarzach ktoś napisał, że dostęp do crypto api jest ograniczony do
"secure origins". Czy to znaczy, że jeśli odpalam w przeglądarce stronę bez
SSLa (bo nie mam lokalnie żadnego certyfikatu) to może być przyczyną
niedziałania crypto api? Czy da się to obejść?

-- 
pozdrawiam
Roman Tyczka

Back to pl.comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hashing library Roman Tyczka <noemail@because.no> - 2018-08-03 14:32 +0200
  Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-03 15:33 +0200
    Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-03 15:45 +0200
      Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-03 16:15 +0200
      Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-03 19:57 +0200
        Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-06 14:41 +0200
          Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-06 22:23 +0200
          Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-08 22:34 +0200
            Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-09 11:04 +0200
              Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-10 11:49 +0200
                Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-10 12:41 +0200
                Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-10 20:03 +0200
        Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-10 12:47 +0200
          Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-10 22:34 +0200
            Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-08-13 12:02 +0200
              Re: Hashing library Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2018-08-13 14:46 +0200
              Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-08-19 21:40 +0200
                Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-09-04 09:30 +0200
                Re: Hashing library Tomek <skowtom@wp.xxx.pl> - 2018-09-04 09:45 +0200
                Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-09-04 10:59 +0200
                Re: Hashing library Wojciech Bancer <wojciech.bancer@gmail.com> - 2018-09-04 14:30 +0200
                Re: Hashing library Roman Tyczka <noemail@because.no> - 2018-09-04 15:17 +0200
                Re: Hashing library Wojciech Bancer <wojciech.bancer@gmail.com> - 2018-09-04 15:55 +0200
                Re: Hashing library Wojciech Bancer <wojciech.bancer@gmail.com> - 2018-09-04 16:41 +0200
                Re: Hashing library Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2018-09-04 19:05 +0200
                Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-09-06 22:46 +0200
                Re: Hashing library Wojciech Bancer <wojciech.bancer@gmail.com> - 2018-09-06 23:13 +0200
                Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-09-07 13:07 +0200
                Re: Hashing library Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2018-09-04 19:03 +0200
                Re: Hashing library Borys Pogoreło <borys@pl.edu.leszno> - 2018-09-06 22:58 +0200

csiph-web