HMAC and toHexString

2018-07-17 Thread Nicholas Wilson via Digitalmars-d-learn
... string key = "blahblahblah"; auto mac = hmac!SHA256(key.representation); string s = ...,t=...u=...,v=...; foreach(w;AliasSeq!(s,t,u,v)) mac.put(w.representation); ubyte[32] s = mac.finish; string sig = toHexString!(LetterCase.lower)(s); writeln(sig); // From what I understand

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-17 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 16:39:48 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 15:55:03 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: [...] I'm going to create an issue on Github. This is the output I get: [...] I solved that problem but now I have

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-17 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 15:55:03 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: [...] I'm going to create an issue on Github. This is the output I get: [...] I solved that problem but now I have others. dpp is a good thing on paper but maybe not yet in

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-17 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: I just build it using dub then do something like that(from memory): `d++ some_c_header.h --include-path path/to/other/c/header/files --keep-d-files` and it generates d file for the corresponding c header. Although dpp is intended to be

Re: names not demangled in nm --demangle=dlang

2018-07-17 Thread Seb via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 15:39:39 UTC, Zheng (Vic) Luo wrote: Hi, I built a simple program with dmd a.d and tried to observe symbols with nm --demangle=dlang ./a. However, I can observe that only part of the symbols (e.g., std.stdio.File.size()) are demangled, while others remain in their

names not demangled in nm --demangle=dlang

2018-07-17 Thread Zheng Luo (Vic) via Digitalmars-d-learn
Hi, I built a simple program with dmd a.d and tried to observe symbols with nm --demangle=dlang ./a. However, I can observe that only part of the symbols (e.g., std.stdio.File.size()) are demangled, while others remain in their original name (e.g., _D3std5stdio4File8opAssignMFNfSQBdQBcQzZv).

Re: Check whether a range is empty

2018-07-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 13:59:45 UTC, Gary Willoughby wrote: I thought every range at the lowest level has an `empty` property. So, in this case, it would be: if (PFResutl.toRange.empty) { writeln("Empty"); } Yeah, but it seems, that PFResutl is a range of ranges, and the OP has the

Re: CJK problem when using console outputs

2018-07-17 Thread zhani via Digitalmars-d-learn
On Monday, 16 July 2018 at 18:16:45 UTC, ag0aep6g wrote: On 07/16/2018 11:30 AM, zhani wrote: [...] Try this: import std.stdio: writeln; import std.exception: enforce; import core.sys.windows.windows: CP_UTF8, SetConsoleOutputCP; void main() { SetConsoleOutputCP(CP_UTF8).enforce;

Re: Check whether a range is empty

2018-07-17 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 13 July 2018 at 18:37:35 UTC, vino.B wrote: Hi All, How do i check whether a range is empty. eg. (!PFResutl.toRange).empty. I tired the below, but it is no printing Empty if the range is empty it just prints blank line. if (!(!PFResutl.toRange).empty) { writeln("Empty"); }

Re: Check whether a range is empty

2018-07-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/15/18 8:56 AM, vino.B wrote: On Sunday, 15 July 2018 at 12:18:27 UTC, Steven Schveighoffer wrote: On 7/15/18 7:45 AM, vino.B wrote: [...] I still don't know why you are using chain here as it equates to the identity function in this instance:

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-17 Thread drug via Digitalmars-d-learn
16.07.2018 17:32, bachmeier пишет: On Friday, 13 July 2018 at 19:53:45 UTC, Laeeth Isharc wrote: On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: What are your ideas? If you would like to expose C function and type declarations to D, you could take a look at DPP,

Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-17 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 16 July 2018 at 13:13:53 UTC, Timoses wrote: On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote: On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote: Why does this fail? It doesn't. Not using DMD 2.081.1 under Windows, at least. I tried adding a bitfield since you