Confusing, what is this inside the channel in Go Routines [closed] - go

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Program :
package main
import (
"fmt"
)
func main() {
ch := make(chan int)
fmt.Println(ch)
fmt.Println(0xc000062060)
}
Output :
0xc00009e000
824634122336
What does that output (824634122336) mean?
I think (0xc00009e000) is a starting address of an channel.
If (0xc00009e000 is address of channel)
Then please tell me what is this (824634122336)
else
Then please tell what are those outputs.

0xc00009e000 is a hexadecimal value of 824634122336. So 824634122336 not a value in the channel.
fmt.Println(0x10) //Output: 16
In software calculations, "0x" prefix adding to represent the hexadecimal numbers.
Refer this why-are-hexadecimal-numbers-prefixed-with-0x

Related

Need aes cipher function allow input [6]byte [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed last year.
Improve this question
background
There is a need for a cipher can encode and decode [6]byte.
std function aes.NewCipher not allowed this, because it's definition of blocksize is 16 bytes.
Can't simply padding 6 bytes to 16 bytes. I need print [6]byte as barcode and use barcode for remote and decode in remote.
code
this can run in go playground
// You can edit this code!
// Click here and start typing.
package main
import (
"bytes"
"crypto/aes"
"fmt"
)
func main() {
plain := []byte("4512wqdeqwbuobouihodqwbuo")[:6]
encrypt := make([]byte, 6)
plain2 := make([]byte, 6)
cipher, err := aes.NewCipher([]byte("4512wqdeqwbuobouihodqwbuo")[:16])
if err != nil {
fmt.Println(err)
return
}
cipher.Encrypt(encrypt, plain)
cipher.Decrypt(plain2, encrypt)
if bytes.Compare(plain, plain2) != 0 {
fmt.Println("can't be", plain, plain2, encrypt)
}
}
error:
crypto/aes: input not full block
question
Is there a third party function can match my require?
Or std functions can achieve this in some way?
It's naive to implement this specified function by bit-shift and xor, is there more?
For new, I have implement this function with bit-shift.
There is a need for a cipher can encode and decode [6]byte.
There's a difference between encoding (display data in a different format) and encryption (providing confidentiality). Ciphers are used for encryption. Further I assume you want to encrypt data for the confidentiality reasons.
Is there a third party function can match my require?
Or std functions can achieve this in some way?
In theory - there are ways where padding is not required. Please see different modes of operation. There are modes (CTR, OFB, ..) where the padding is not needed effectively turning the block cipher into a stream cipher.
There are even dedicated stream ciphers, such as Salsa or ChaCha.
So - now you could encrypt 6 bytes of the plaintext into 6 bytes of the ciphertext.
There are two issues when you require sending the same amount of encrypted data as the plaintext:
to keep data confidential while reusing the same key for multiple encryptions, each of the ciphers need some initial state (IV), which can be random or a counter. It is imperative that the same Key and IV are not reused. So under normal circumstances this counter or state is sent along the encrypted data. Using some static vector allow to break the encryption (partly or completely). That's the reason people in the comment cannot give you simple answer. There is no proper encryption without additional data transmitted.
Another issue is with data integrity. Without transmitting additional bytes if the ciphertext is modified in transmission (intentionally or not), receiving party has no means to detect the data has been modified. I assume with 6 bytes there is no integrity control anyway, so maybe this is not your concern.
It's naive to implement this specified function by bit-shift and xor, is there more?
Yes, you can encrypt data using a static IV vector, but this is not properly encrypted as we understand it, so the knowing multiple messages or initial information, the data could be completely decrypted.
Using something simple like XOR, matrix operations, ... could as well reveal the key itself.

Why should add a name before the statement in VHDL? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
ARCHITECTURE synthesis1 OF vending IS
TYPE statetype IS (Idle, Opt1, Opt2, Error);
SIGNAL currentstate, nextstate : statetype;
BEGIN
fsm1: PROCESS( buttons, currentstate ) -- Is necessary to give the PROCESS bl a name?
BEGIN
-- Process the input
END PROCESS;
END synthesis1;
Is necessary to give the Process a name? Why should I set the name?
No. It is not necessary. It is optional. However, sometimes it is useful to give a process (or other statement) a name, for example, to make your code easier to read.

Why snmpset cant save value? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
i'm using this commands for disable mikrotik interface:
user#host:~$ snmpget -v 2c -c public 192.168.0.10 1.3.6.1.2.1.2.2.1.7.3
iso.3.6.1.2.1.2.2.1.7.3 = INTEGER: 1
user#host:~$ snmpset -v 2c -c public 192.168.0.10 1.3.6.1.2.1.2.2.1.7.3 i 2
iso.3.6.1.2.1.2.2.1.7.3 = INTEGER: 2
user#host:~$ snmpget -v 2c -c public 192.168.0.10 1.3.6.1.2.1.2.2.1.7.3
iso.3.6.1.2.1.2.2.1.7.3 = INTEGER: 1
snmp have write-access,
where is problem?
Instead of 'public' you need to use the write community string of the target system. It's like a password, else anyone could change system parameters.

Creating beep sound in Windows [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to write a procedure that creates a beep sound on Windows, using assembly language.
How can I do that? Do you have any starting point idea?
In MS-DOS, which is what many assembly novices are targeting without even knowing it, outputting character ASCII 7 (BEL) via interrupt 21h, function AH=2 will do it:
mov ah, 2
mov dl, 7
int 21h
In Windows, call the MessageBeep() API function, passing 0xffffffff as the parameter. The function resides in User[32].dll; depending on your assembler, the sequence for importing an API function might vary.
If by "Windows" you mean "DOS executable running under Windows", which some people occasionally do, then back to int21h.

How to generate a stack trace with in own kernel module [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I would like to generate a stack trace report like one generated by kernel oops.
------------[ cut here ]------------
kernel BUG at /home/administrator/project/systech/bsp_tan/linux-.2.6/arch/arm/include/asm/dma-mapping.h:325!
Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
Modules linked in:
CPU: 0 Not tainted (3.2.6 #67)
PC is at my_func+0x118/0x230
LR is at vprintk+0x3bc/0x440
Where it's defined and how I can trigger it with in my module.
EDIT 1
How to find the line number where the PC (program counter) was when this bug happened.
PC is at my_func + 0x118/0x230
What this means?
Thanks in advance.
this is in the following files:
lib/bug.c
kernel/panic.c

Resources