SHA256 Signature
Hi, How can I create a SHA256 signature hash in D? Something similar to the PHP code below: ```php openssl_sign($body, $signature, $secret, OPENSSL_ALGO_SHA256); ``` I've tried the code below without success: ```d auto signature = body.representation.hmac!SHA256(secret.representation).toHexString!(LetterCase.lower).to!string; ```
Re: aligned struct field weirdness
On Monday, 17 June 2024 at 19:45:18 UTC, realhet wrote: Hello, I'm having a weird case of access violation. Often times, you are focused on something that isn't the problem, but *triggers* the problem. Not saying it's not a compiler error, it could be. But chances are pretty low. If you cannot get this to happen unless you use your custom writeln thing, I'd focus on trying to figure out if that custom writeln is doing something incorrect. All the code you posted here looks fine to me. It compiles and runs fine on run.dlang.io (even with the `version(none)` changed to `version(all)`, or using `scoped!B`). -Steve
Google Auth API
Hi, Has anyone here had experience implementing the Google Auth Library in DLang? Specifically, I am looking for guidance on handling OAuth 2.0 using JWT. Are there any current libraries available for this purpose?
Re: What's the latest GDC stable release version?
and GDC 14: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=09992f8b881aa2dfbee1e9d6954c3ca90cd3fe41 So GDC 14.1 includes the D language at v2.108.0. This is wonderful: Synchronizing with the upstream release of v2.108.0. BTW, if the following two pages are updated with version information, that will be great: https://dlang.org/download.html https://gdcproject.org/downloads
aligned struct field weirdness
Hello, I'm having a weird case of access violation. I tried to narrow the problem and put up a reproducible testCase on compilerexploer, but it requires my framework too which overrides std.stdio.writeln() in order to produce colorful text, and logging, etc. The error is an access violation when I access the struct in the f() function. Sometimes it can be fixed (marked the place.) In one sentence: It is an aligned struct field, whose struct is given to a class as a template parameter. Maybe the weirdness is caused by the align(16)? When the fields of the struct are placed on the instance of the class? I know it's not reproduceable, maybe it was a bug that had been already fixed. So I only ask if the situation is familiar to someone, please tell me, what tricks I need to avoid. I can avoid the align using dummy fields. I can allocate the struct with new. But it's a bummer, that the nicest version is unstable. ``` import het; struct S { int a; align(16)//<-this triggers it int[4] b; } class A(T) { version(none) { T u; } else { T* p; //<- this fixes it. (The struct is not on the class surface) ref u() { return *p; } this() { p = new T; } } } class B: A!S { void f() { writeln(u.text/+<-The access violation can be here+/); } } void main() { //writeln("a"); <- this fixes it auto b = new B; //<-scoped! can trigger it too b.f; } ``` Thank You in advance.
Re: What's the latest GDC stable release version?
On Monday, 17 June 2024 at 16:20:55 UTC, mw wrote: On Monday, 17 June 2024 at 15:33:46 UTC, Dejan Lekic wrote: On Sunday, 16 June 2024 at 16:26:08 UTC, mw wrote: Hi, What's the latest GDC stable release version? Stable release version is the same as stable GCC release version. Find it here: https://gcc.gnu.org/ (GDC is part of the GCC project for years) Thanks, but it's not clear which D (dmd) language version they are corresponding to,e.g. I found: https://forum.dlang.org/post/qbjmtdyglcwmzekyx...@forum.dlang.org GCC version 12.2 has been released. Updated the D front-end from v2.100.0-rc1 to v2.100.1. But for GCC 13, 14, the status is less clear: are these version stable and released, and when? https://forum.dlang.org/post/amsduzcnbgvptaxjt...@forum.dlang.org He was also preparing to push out GDC 13.2. GDC 13 maps to DMD 2.103. He had backported around ten regression fixes for it so far. GDC 14, the current development version, was still tracking the upstream DMD mainline. There were no blockers there and everything was going fine merging from DMD master down to GDC. The changes document for gcc-12 did provide this information: https://gcc.gnu.org/gcc-12/changes.html However, the changes document for gcc-13 and gcc-14 appear not to. Iain does always document updates to the language version: https://gcc.gnu.org/git/?p=gcc.git&a=search&h=HEAD&st=commit&s=D+front-end To get the D versions for any version of GDC, you can triangulate commits. That will lead you to this commit for GDC 13: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=328477f6ee82d27fa6bb09617644d409be300688 and GDC 14: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=09992f8b881aa2dfbee1e9d6954c3ca90cd3fe41 So GDC 14.1 includes the D language at v2.108.0. ~Brian
Re: What's the latest GDC stable release version?
On Monday, 17 June 2024 at 15:33:46 UTC, Dejan Lekic wrote: On Sunday, 16 June 2024 at 16:26:08 UTC, mw wrote: Hi, What's the latest GDC stable release version? Stable release version is the same as stable GCC release version. Find it here: https://gcc.gnu.org/ (GDC is part of the GCC project for years) Thanks, but it's not clear which D (dmd) language version they are corresponding to,e.g. I found: https://forum.dlang.org/post/qbjmtdyglcwmzekyx...@forum.dlang.org GCC version 12.2 has been released. Updated the D front-end from v2.100.0-rc1 to v2.100.1. But for GCC 13, 14, the status is less clear: are these version stable and released, and when? https://forum.dlang.org/post/amsduzcnbgvptaxjt...@forum.dlang.org He was also preparing to push out GDC 13.2. GDC 13 maps to DMD 2.103. He had backported around ten regression fixes for it so far. GDC 14, the current development version, was still tracking the upstream DMD mainline. There were no blockers there and everything was going fine merging from DMD master down to GDC.
Re: What's the latest GDC stable release version?
On Sunday, 16 June 2024 at 16:26:08 UTC, mw wrote: Hi, What's the latest GDC stable release version? Stable release version is the same as stable GCC release version. Find it here: https://gcc.gnu.org/ (GDC is part of the GCC project for years)
Re: Pointer to dlang spec for this alias construct?
On Monday, 17 June 2024 at 05:05:06 UTC, Jonathan M Davis wrote: alias Unshared(T) = T; alias Unshared(T: shared U, U) = U; ... Unshared is an eponymous template. https://dlang.org/spec/template.html#implicit_template_properties And it's using a shortcut syntax. ... The second template uses a template specialization https://dlang.org/spec/template.html#parameters_specialization No wonder I couldn't find it in the spec; I was looking for an "alias" language feature. alias as used here leans on a template mechanism--specialization. It might have taken many readings of the spec to have hunted that down, so--thank you. It's quite an interesting mechanism. D is quite easy for a C programmer to get started with, but it certainly has its depths! Andy